Remove empty lines
Converted in your browser · nothing is uploaded
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
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.