Remove Empty Lines
Strip blank lines out of pasted text, or collapse long runs of them down to a single separator. Lines that contain only spaces or tabs count as empty, which is what breaks most naive approaches.
How Remove Empty Lines works
Paste text with unwanted vertical gaps.
Choose to remove every blank line or collapse runs to one.
Check how many lines were removed.
Copy the tightened text.
When to use Remove Empty Lines
- Tidying text pasted from a PDF or email where a blank line has crept in after almost every line.
- Collapsing the double and triple gaps that build up in a draft down to one clean paragraph break.
- Clearing whitespace-only lines — a stray space or tab on an otherwise empty line — that a plain search for empty lines skips over.
- Compacting a config file or CSV export before you diff it against another copy, so the spacing does not drown out the real changes.
- Preparing a list for an import that rejects or mishandles empty rows.
- Flattening the extra vertical space left behind after you delete a block from the middle of a document.
Examples
Input
alpha beta gamma
Output
alpha beta gamma
Remove-all deletes each blank line, including the one that held only a single space, leaving a solid block of three lines.
Input
Intro paragraph. Second paragraph.
Output
Intro paragraph. Second paragraph.
Collapse keeps exactly one blank line between the two blocks, so the paragraph break survives while the three extra gaps disappear.
Input
last line
Output
last line
In collapse mode a run of blank lines trailing the final content is dropped entirely, since a gap at the very end is noise rather than a separator.
How Remove Empty Lines works under the hood
The text is first split into lines on any line ending. Carriage-return and CRLF breaks are normalised to line feeds before anything else happens, so a file copied from a Windows editor is treated exactly like one from macOS or Linux and you never end up with a stray carriage return sitting on its own.
A line counts as blank when trimming it leaves nothing — so a line holding only spaces or tabs is blank, not just a truly empty one. This is the case that trips up a naive find-and-replace on “\n\n”, which sees a space between two newlines and leaves the gap in place. Here that line is removed like any other.
Remove-all keeps only the lines with visible content, dropping every blank regardless of where it sits, and the result is one continuous block. Collapse walks the lines in order and skips a blank only when the previous line was also blank, so each run of consecutive blanks is reduced to a single empty line and the breaks between paragraphs are preserved.
After collapsing, any blank line left dangling at the very end is popped off, because a trailing gap is not a real paragraph separator. The removed count in the sidebar is simply the input line count minus the output line count, so you can see at a glance how much vertical space was reclaimed.
Common mistakes
- Expecting spaces inside a content line to be tidied. This tool works on whole lines only — a line that has text plus trailing spaces is kept as-is. Reach for Whitespace Cleaner when you want to trim inside lines.
- Choosing Remove all when you meant to keep paragraphs. Remove all fuses every block together with no gaps; if you want the prose to stay readable, Collapse runs is almost always the mode you want.
- Assuming a “blank” line has to be truly empty. A line with only a tab or a couple of spaces looks empty but is not, and it is exactly what other tools leave behind — this one treats it as blank and removes it.
- Using this to deduplicate. Removing empty lines does not touch repeated content lines; several identical non-blank lines all survive. Remove Duplicate Lines is the tool for that.