Boneyard Tools

Remove Empty Lines From Text

Paste text and this tool deletes every blank line, including lines that only hold spaces or tabs, while keeping your real content in its original order. Turn on 'Trim each line' to also shave stray whitespace off the ends of the lines you keep, or 'Collapse to single blank line' to squash big gaps down to one blank between paragraphs. A live counter shows how many lines were removed.

How to remove empty lines

  1. Paste or type your text into the 'Your text' box.
  2. Leave both options off to strip every blank and whitespace-only line.
  3. Tick 'Trim each line' to remove leading and trailing spaces from kept lines.
  4. Tick 'Collapse to single blank line' to keep one blank between blocks instead of none.
  5. Check the 'lines removed' count, then copy the cleaned text from the Result box.

Examples

Strip all blank lines

Apple


Banana
   
Cherry
Apple
Banana
Cherry

Collapse gaps to single blanks

Block one



Block two
Block one

Block two

Trim while stripping blanks

  keep me  
   
  and me  
keep me
and me

Frequently asked questions

Does it remove whitespace-only lines too?

Yes. A line counts as empty when it has no non-whitespace characters, so lines made only of spaces or tabs are removed just like fully blank ones. This catches the invisible padding that plain 'delete blank line' tools often miss.

What does 'Collapse to single blank line' do?

Instead of deleting every blank, it keeps exactly one blank line between blocks of text, so paragraph breaks survive while long runs of empty lines are squashed. Leading and trailing blanks are still dropped in this mode.

What does 'Trim each line' do?

It removes leading and trailing spaces and tabs from every line you keep. It also means a line padded only with spaces is seen as blank before trimming, so it gets removed rather than left as an empty trimmed line.

Will the order of my lines change?

No. The content lines stay exactly where they were relative to each other. Only blank lines are removed, so paragraphs, lists and code keep their sequence.

Does it handle Windows and Mac line endings?

Yes. Windows CRLF, classic Mac CR and Unix LF are all recognized when the text is split into lines, and the cleaned output always uses standard LF newlines.

How is this different from removing line breaks?

Removing line breaks flattens everything onto one line. This tool keeps your line structure intact and only deletes the empty lines, so a list stays a list rather than becoming a single run-on line.

Is there a size limit?

There is no fixed cap. The work runs in your browser, so the practical limit is your device memory, and the counter and result update as soon as you paste or change an option.

Can I use this on code or CSV?

Yes. It only touches whitespace and blank lines, so code indentation stays put unless you enable trimming, and empty rows in pasted CSV text are dropped without altering the data rows.

Is my text private?

Yes. Everything runs locally in your browser and nothing is uploaded to a server, so even sensitive text stays on your device.

Learn more

Related tools