Remove Empty Lines
This tool removes empty lines from text, with one important detail: a line that contains only spaces or tabs looks blank but is not, and a tool that tests for zero length will leave every one of them behind. Trimming each line first — on by default — is what makes the removal actually work on real files, where leftover indentation is the norm rather than the exception. You can also collapse runs of blank lines down to a single one instead of removing them entirely, which keeps paragraph separation while clearing out the four or five consecutive blanks that copy-and-paste tends to leave.
How it works
Removes lines that are empty or contain nothing but spaces and tabs. Trimming first is what makes that work on real files, where a "blank" line usually holds leftover indentation.
Collapsing instead of removing keeps paragraph separation while getting rid of the runs of four or five blank lines that copy-and-paste leaves behind.
Everything runs in your browser — nothing you paste is sent to a server.
0 lines in · 0 out · 0 characters.
The lines that only look blank
Open almost any file that has been through an editor, an export or a copy-and-paste and you will find lines containing a couple of spaces or a stray tab. They render as blank and read as blank, but a check for zero length says they are not, so they survive every naive attempt to remove them.
Trimming each line before the test is the whole fix, and it is on by default here for that reason.
Removing versus collapsing
Removing every blank line is right for a list of values, where the blanks are pure noise. Collapsing is right for prose, where a single blank line separates paragraphs and only the runs of four or five are a problem.
Common use cases
- Tidying a list pasted out of a document or an email.
- Compacting a config or data file before committing it.
- Preparing a list for a tool that treats a blank line as end-of-input.
Frequently asked questions
How do I remove empty lines?
Paste your text into the left panel. Blank lines are removed immediately and the result appears on the right.
What about lines containing only spaces?
They are removed too, as long as trimming is left on. Those lines look blank but are not empty, and a length test alone would miss every one of them.
How do I keep paragraph breaks?
Tick "Collapse to one blank line instead of removing". Runs of several blank lines become a single one, so paragraphs stay separated.
Does it change the lines themselves?
Only if trimming is on, which removes leading and trailing whitespace from each line. Untick it to leave every surviving line exactly as it was.
Will it affect line endings?
The output uses newline characters throughout. Windows-style carriage returns in the input are handled and normalised.
Is my text uploaded?
No. Everything runs in your browser.
Related tools
Remove Extra Spaces
This tool collapses repeated spaces and can strip the invisible characters too.
Text Cleaner
This text cleaner runs several tidy-up passes in the right order, in one go.
Line Sorter & Deduplicator
Sort lines alphabetically, numerically, or randomly, and remove duplicate lines in one click.