Remove empty lines
Deletes blank lines — or collapses runs of them down to one.
Press the button and every blank line disappears. The message underneath reports how many were removed.
The line that looks empty but is not
A line containing three spaces looks exactly like an empty line and is not one. Tools that only check for a zero-length line leave those behind, and the result is text that still has gaps in it after you have supposedly removed the gaps — one of the most common complaints about this category of tool.
"Also remove lines with only spaces" is on by default and handles it, treating any line with nothing but whitespace — spaces, tabs, or both — as empty. Turn it off in the rare case where a whitespace-only line is meaningful, such as in fixed-width data.
Remove or collapse
Two different jobs live here. Remove deletes every blank line, producing a solid block. That is what you want for a list, a set of values, or anything you are about to import.
Collapse keeps one blank line wherever there were several. That is what you want for prose. Text pasted from a PDF or an email chain often has three or four blank lines between paragraphs; removing them all runs the paragraphs together and makes the text harder to read, while collapsing restores normal paragraph spacing.
Pick by asking what the blank lines mean in your text. If they are noise, remove. If they are structure that got multiplied, collapse.
Where blank lines come from
- PDF extraction. Every visual line gap becomes one or more blank lines.
- Copying from web pages. Block elements each end with a break, so a list becomes double-spaced.
- Spreadsheet exports. Empty rows between sections become empty lines.
- Email chains. Each reply level adds its own spacing.
- Word processors. Manual line breaks used for layout instead of paragraph spacing.
In most of those cases the blank lines are accompanied by trailing spaces from the same source, so trimming first and removing second gives a cleaner result than either alone. The trim button is on this page for that reason.
Doing it without this tool
Notepad++: Edit → Line Operations → "Remove Empty Lines" and "Remove Empty Lines (Containing Blank Characters)". Two separate menu items, which tells you how often the distinction matters.
VS Code: Find & Replace with regex on, search ^\s*\n and replace with nothing. Enabling
regex mode is the step people forget, and without it the search finds nothing and looks broken.
Excel: select the column, F5 → Special → Blanks, then delete rows. Works on rows, not on text inside a cell.
Word: Find & Replace, search ^p^p and replace with ^p, repeated until the count
reaches zero. Each pass halves the runs rather than clearing them, which is why it takes several.
Command line: grep -v '^[[:space:]]*$' file.txt, or cat -s file.txt to collapse
runs into one.
Runs entirely in your browser. Your text is never uploaded — open DevTools, Network tab, and you will see zero requests while you use this tool.
How to use it
- Paste your text into the box.
- Keep "Also remove lines with only spaces" ticked so invisible whitespace lines go too.
- Press "Remove empty lines" — or tick "Collapse runs" first if you want to keep single blank lines between paragraphs.
- Check the removed count in the message underneath.
Related tools
Frequently asked questions
Because a line containing only spaces or tabs is not technically empty, and tools that check only for zero length skip it. The option here treats any whitespace-only line as empty, which is what people almost always mean.
Tick "Collapse runs into one blank line instead". Runs of several blank lines become one, so paragraph spacing survives while the excess goes.
No. Only whole blank lines are removed; the content of the remaining lines, including their spacing, is untouched. Use the trim tool if you also want whitespace cleaned inside lines.
The message under the buttons reports the count after every run, so you can tell at a glance whether it did what you expected.