Remove Empty Lines
Delete blank lines from pasted text, collapse runs of blank lines into a single break, and optionally trim the spaces at the start and end of each line.
Your text is processed locally in your browser and is not uploaded to our servers.
Result
0 charactersSummary
What this tool does
Blank lines pile up when text is copied between programs, exported from a PDF, or pasted from an email. They break up lists, add awkward gaps, and create empty elements when pasted into a web editor. This tool removes them — either all of them, or just the extras when several stack up in a row.
How to use it
- Paste the text with the blank-line problem.
- Choose Remove all blank lines for a tight block, or Collapse runs to keep single blank lines as separators while removing the doubles and triples.
- Keep Treat lines with only spaces as blank on, so lines that look empty but contain spaces are removed too.
- Copy the cleaned result.
How blank lines are detected
The tool works line by line. A line is considered blank when it is completely empty, or — with Treat lines with only spaces as blank on — when it contains nothing but spaces and tabs. That second option matters because "empty" lines from a copy-paste often hold a stray space, which a naive tool would keep.
In remove mode, every blank line is deleted and the remaining lines close up. In collapse mode, a run of consecutive blank lines is replaced by a single blank line, so paragraph separation is preserved while the excess is removed. This is the right choice when the blank lines are meaningful but there are simply too many of them.
Windows and old Mac line endings are normalized first, so a file from any operating system is cleaned consistently. The Trim spaces option additionally removes leading and trailing whitespace from the non-blank lines it keeps.
Examples
This input (each ¶ is a line):
First line
Second line
Third line
In remove mode becomes three tight lines. In collapse mode it becomes:
First line
Second line
Third line
with single blank lines kept as separators and the extra gaps removed. A frequent use: a list pasted from a spreadsheet arrives with a blank line after every row; remove mode turns it back into a clean list in one click.
Common use cases
- Cleaning copied lists where every item is separated by a blank line.
- Tidying PDF and email exports that scatter blank lines through the text.
- Preparing text for a CMS so it does not create empty paragraphs.
- Normalizing spacing between paragraphs with collapse mode.
- Compacting data before importing it into another tool.
For repeated lines rather than blank ones, use Remove Duplicate Lines; to also reorder, use Sort Lines.
Privacy and security
Everything runs in your browser. Nothing is uploaded, so pasted lists and documents stay private. Your options are saved locally. See the privacy policy.
Frequently asked questions
What is the difference between remove and collapse?
Remove deletes every blank line, producing a tight block. Collapse keeps a single blank line wherever there was at least one, so paragraph separation survives but runs of two or more blank lines are reduced to one.
Why are some "empty" lines not removed?
They probably contain spaces or tabs, so they are not truly empty. Turn on Treat lines with only spaces as blank and they will be removed too.
Does it change the order of my lines?
No. Only blank lines are removed or collapsed; the remaining lines stay exactly where they were, in the same order.
Can it also trim spaces from each line?
Yes. Turn on Trim spaces at the start and end of each line and the kept lines will have their leading and trailing whitespace removed as well.
Will it join my lines together?
No. This tool only removes blank lines; the lines that remain keep their own line breaks. To join lines into one block, use the Line Break Remover.
Related tools
Tools that pair well with the Remove Empty Lines.