Remove Empty Lines
Strip blank lines from a text block, or collapse runs of several blank lines down to one.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Remove Empty Lines tool does
Use this remove empty lines tool to strip blank lines from a text block, or collapse runs of several blank lines down to one. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for cleaning up text pasted from a PDF or formatted document. For a second version of this remove empty lines tool, see FreeToolStation.org.
How to use it
- Paste the text containing blank lines.
- Choose whether to remove every blank line or collapse runs down to one.
- Leave trailing-space trimming on so whitespace-only lines count as blank.
- Copy the cleaned result.
How it works
A line containing only spaces or tabs looks blank and is not, which is why the trailing-space option matters. Without it, a line of three spaces survives the cleanup and continues to look like an empty line that cannot be removed.
The collapse option is the one to use on prose, where paragraph breaks are meaningful and you only want to remove the accidental triples. Removing every blank line in prose runs all the paragraphs together.
Pasting from a PDF or a formatted document is the usual source of this problem: each visual line arrives as its own paragraph with blank lines between, and the text needs both reflowing and cleaning.
When to use it
- Cleaning up text pasted from a PDF or formatted document.
- Compacting a list that has gaps in it.
- Removing the extra blank lines a text export leaves behind.
- Normalising paragraph spacing in prose.
Common mistakes to avoid
- Removing every blank line in prose, which merges all the paragraphs.
- Leaving whitespace-only lines, which look blank but are not.
- Forgetting that the result still has whatever line endings the source used.
Frequently asked questions
How do I remove blank lines from text?
Paste it in. Every empty line is removed by default, or pick the collapse option to reduce runs of blank lines to one.
Why do some blank lines survive in other tools?
Because they contain spaces or tabs rather than nothing. Trimming trailing whitespace first makes them genuinely empty and removable.
Should I use collapse or remove on prose?
Collapse. Paragraph breaks in prose are meaningful; removing every blank line runs the paragraphs together.