TOOLTIKI Lovable tool, really free
Text Cleanup

Remove empty lines

What to do

Converted in your browser · nothing is uploaded

Local · whitespace-only lines count as empty
Advertisement
320 × 100

Removes blank lines from a block of text, including lines that only contain spaces or tabs — which look empty and are not, and are the reason a find-and-replace on double line breaks leaves some behind.

How to use the remove empty lines

1 Paste your text — the result appears as you type.
2 Pick a different conversion if you need one.
3 Copy the result.

A line containing three spaces looks identical to an empty one and is not empty, which is why removing blank lines with a find-and-replace on \n\n misses some and leaves an uneven result. Whitespace-only lines are treated as empty here, which is what people mean.

The usual source of the problem is copying out of a PDF or a formatted document, where every visual line break arrives as a real line break and paragraph spacing arrives as extra ones. Text pasted from a PDF often has a break at the end of every printed line as well, which is a different problem — for that you want the line break remover, which joins the text back into paragraphs.

Order is preserved and nothing else is touched. Leading and trailing spaces on a non-empty line are left alone, because trimming them is a separate decision and one that occasionally matters — indentation in pasted code being the obvious case.

Questions

Yes. A line of three spaces looks empty and is not, which is why a find-and-replace leaves some behind.

MDN — StringUnicode — case mapping
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING