Remove empty lines

Deletes blank lines — or collapses runs of them down to one.

Press the button and every blank line disappears. The message underneath reports how many were removed.

The line that looks empty but is not

A line containing three spaces looks exactly like an empty line and is not one. Tools that only check for a zero-length line leave those behind, and the result is text that still has gaps in it after you have supposedly removed the gaps — one of the most common complaints about this category of tool.

"Also remove lines with only spaces" is on by default and handles it, treating any line with nothing but whitespace — spaces, tabs, or both — as empty. Turn it off in the rare case where a whitespace-only line is meaningful, such as in fixed-width data.

Remove or collapse

Two different jobs live here. Remove deletes every blank line, producing a solid block. That is what you want for a list, a set of values, or anything you are about to import.

Collapse keeps one blank line wherever there were several. That is what you want for prose. Text pasted from a PDF or an email chain often has three or four blank lines between paragraphs; removing them all runs the paragraphs together and makes the text harder to read, while collapsing restores normal paragraph spacing.

Pick by asking what the blank lines mean in your text. If they are noise, remove. If they are structure that got multiplied, collapse.

Where blank lines come from

In most of those cases the blank lines are accompanied by trailing spaces from the same source, so trimming first and removing second gives a cleaner result than either alone. The trim button is on this page for that reason.

Doing it without this tool

Notepad++: Edit → Line Operations → "Remove Empty Lines" and "Remove Empty Lines (Containing Blank Characters)". Two separate menu items, which tells you how often the distinction matters.

VS Code: Find & Replace with regex on, search ^\s*\n and replace with nothing. Enabling regex mode is the step people forget, and without it the search finds nothing and looks broken.

Excel: select the column, F5 → Special → Blanks, then delete rows. Works on rows, not on text inside a cell.

Word: Find & Replace, search ^p^p and replace with ^p, repeated until the count reaches zero. Each pass halves the runs rather than clearing them, which is why it takes several.

Command line: grep -v '^[[:space:]]*$' file.txt, or cat -s file.txt to collapse runs into one.

Try:
0Words
0Characters
0No spaces
0Sentences
0Paragraphs
0Lines
0Pages
0Reading
0Speaking

Runs entirely in your browser. Your text is never uploaded — open DevTools, Network tab, and you will see zero requests while you use this tool.

How to use it

  1. Paste your text into the box.
  2. Keep "Also remove lines with only spaces" ticked so invisible whitespace lines go too.
  3. Press "Remove empty lines" — or tick "Collapse runs" first if you want to keep single blank lines between paragraphs.
  4. Check the removed count in the message underneath.

Related tools

Remove punctuationStrips punctuation and symbols, optionally keeping apostrophes and hyphens.Sort linesAlphabetical or reverse sorting for any list, with natural number order.Remove stop wordsStrips common English filler words and leaves the words that carry meaning.Remove duplicate wordsDeletes repeated words and keeps the first of each. Different from removing…Coin flipHeads or tails in one tap, with a running tally.Small capsSmall capital letters that paste anywhere plain text goes.Name pickerPaste a list, pick a winner. No account, no cloud, no limit.

See all text tools →

Frequently asked questions

Why are some blank lines left behind by other tools?

Because a line containing only spaces or tabs is not technically empty, and tools that check only for zero length skip it. The option here treats any whitespace-only line as empty, which is what people almost always mean.

How do I keep one blank line between paragraphs?

Tick "Collapse runs into one blank line instead". Runs of several blank lines become one, so paragraph spacing survives while the excess goes.

Does it change anything else in my text?

No. Only whole blank lines are removed; the content of the remaining lines, including their spacing, is untouched. Use the trim tool if you also want whitespace cleaned inside lines.

How many lines were removed?

The message under the buttons reports the count after every run, so you can tell at a glance whether it did what you expected.