About the Remove Empty Lines tool
Text copied from web pages, PDFs, emails and code editors often arrives full of blank lines. Some are truly empty, others contain invisible spaces or tabs that make them look empty while still breaking scripts, CSV imports and neat formatting. Deleting them one by one is tedious in a long document.
This tool removes those lines instantly. Choose whether to delete every empty line, collapse runs of blank lines down to a single blank line so paragraphs stay separated, or only strip blank lines at the very start and end. With "Treat whitespace-only lines as empty" switched on, lines containing only spaces, tabs or no-break spaces count as empty too. You can also trim trailing spaces from the lines you keep.
Windows (CRLF) and Unix (LF) line endings are both understood, and the summary under the result tells you how many lines went in, how many came out and how many were removed. The work happens entirely in your browser, so logs, lists and private notes stay on your device.
How to use Remove Empty Lines
- Paste your text into “Text with blank lines” or click “Sample”.
- Under “What to remove”, choose all empty lines, collapse runs to one, or only leading and trailing blank lines.
- Keep “Treat whitespace-only lines as empty” on to catch lines that contain only spaces or tabs.
- Optionally switch on “Trim trailing spaces”.
- Copy the cleaned text or download it as a .txt file.
Features
Three removal modes
Remove all blank lines, collapse multiple blanks to one, or trim only the edges.
Whitespace-only detection
Lines holding just spaces, tabs or no-break spaces can be treated as empty.
Trailing space trim
Optionally strips spaces and tabs from the end of the lines you keep.
Line counts
Shows lines in, lines out and blank lines removed.
Handles any line ending
Normalises Windows CRLF and old Mac CR line breaks.
When to use it
- Clean up a list of emails, URLs or product codes before pasting it into a spreadsheet.
- Tidy text copied from a PDF that has blank lines between every line.
- Remove blank lines from a log file or configuration snippet.
- Keep paragraph breaks but remove the extra gaps in an article draft.
Frequently asked questions
What counts as an empty line?
A line with no characters at all. With the whitespace option on, a line that only contains spaces, tabs or no-break spaces also counts as empty.
Can I keep one blank line between paragraphs?
Yes. Choose “Collapse runs to a single blank line”. Any group of blank lines becomes exactly one, and blank lines at the start and end are removed.
Does it change the text on non-empty lines?
No, unless you turn on “Trim trailing spaces”, which removes spaces and tabs at the end of lines. Leading indentation is always kept.
How do I remove all line breaks instead?
This tool deletes blank lines but keeps line breaks between text lines. To join everything into one paragraph, use the Remove Line Breaks tool.