Remove Empty Lines
Delete blank lines from text, collapse runs of them to one, or trim them only from the start and end.
This guide is not yet available in your language and is shown in English.
Tool guide
What this tool does
Remove Empty Lines cleans blank and whitespace-only lines out of lists, logs, code and copied documents. Three modes let you remove every empty line, squeeze multiple blank lines down to a single separator, or only trim the blank lines at the top and bottom.
Blank lines creep into text from many places: exported spreadsheets with empty rows, chat logs, HTML converted to text, or code where an editor left gaps. A few are harmless, but in a list of email addresses or a data file each empty line becomes an empty record, and in prose a stack of five blank lines looks like a formatting error.
The tool splits your text on every kind of line ending and tests each line. With the whitespace option on, a line holding only spaces or tabs counts as empty too, which catches lines that look blank but are not. You can then delete them all, keep a single blank line wherever there was a run (useful for preserving paragraphs), or only strip leading and trailing blank lines. Output can use LF or CRLF endings, and the work happens locally in your browser.
How to use Remove Empty Lines
- Paste your text or drop a text file into the input area.
- Choose a Mode: remove all empty lines, collapse runs into a single empty line, or trim only at the start and end.
- Keep “Treat lines with only spaces or tabs as empty” on unless those lines are deliberate.
- Optionally turn on “Remove trailing spaces from kept lines” to clean up line endings as well.
- Pick LF or CRLF under “Line endings in output” to match the system the text is going to.
- Check “Lines removed” in the statistics, then copy or download the result.
Tips for better results
- Collapse mode is the safest choice for articles and emails because paragraphs stay separated by exactly one blank line.
- Choose CRLF output when the text will be opened in Notepad on older Windows versions or fed to a Windows batch script.
- Combine this tool with Remove Duplicate Lines to turn a messy pasted list into a clean set of unique entries.
- For a CSV file, remove empty lines before importing so the importer does not create blank rows.
Common use cases
- Cleaning a column of email addresses copied from a spreadsheet with gaps.
- Tidying log output before sharing it in a bug report.
- Removing the blank rows a PDF or web page adds between paragraphs.
- Trimming stray blank lines at the end of a configuration file.
Common mistakes to avoid
- Removing every empty line from prose, which fuses all paragraphs into one block; use collapse mode instead.
- Turning off the whitespace option and wondering why lines that look empty are still there.
- Stripping blank lines from Markdown or YAML where they separate lists, code blocks or documents.
Frequently asked questions
What counts as an empty line?
A line with no characters at all. When the whitespace option is on, a line containing only spaces and tabs is also treated as empty. Lines with any visible character, even a single full stop, are always kept.
What does collapse mode do exactly?
Every run of consecutive empty lines is replaced by one empty line, and empty lines at the very beginning and end are removed. Three blank lines between two paragraphs become one.
Does it change line endings?
The output uses the line ending you choose, LF by default or CRLF for Windows. Input with any mix of CR, LF and CRLF endings is read correctly.
Can it handle a large file?
Yes. Processing is a single pass over the lines, so files with hundreds of thousands of lines finish quickly; input is debounced while you type so the page stays responsive.
Feedback & suggestions
Help us improve Remove Empty Lines. We read every message.