toolqik

157 · Text

Remove Empty Lines

Delete blank lines from text, or keep single blank lines between paragraphs.

Runs in your browser
Mode
Options
Text without empty lines

  

About this tool

Delete blank lines from a list, a log, code or text copied from a document. Paste it and every empty line is removed, so items sit on consecutive lines. Choose Keep one between paragraphs to tidy up instead: runs of blank lines shrink to a single one and blank lines at the start and end are removed, which keeps paragraphs readable.

What counts as empty

A line with nothing on it is empty. By default, a line containing only spaces or tabs is treated as empty too, because it looks blank. Turn that option off to remove only truly empty lines and keep whitespace-only lines (for example in code where indentation on blank lines matters).

Line endings are preserved: Windows (CRLF) text stays CRLF. The status line shows how many lines were removed.

In code and editors

grep -v '^\s*$' file.txt           # command line
sed '/^[[:space:]]*$/d' file.txt

// JavaScript
text.split('\n').filter(l => l.trim()).join('\n');

In VS Code, use Find with regex ^\s*$\n and replace with nothing. Or use this tool’s big brother, find and replace.

FAQ

How do I remove blank lines from text?

Paste the text into the box. All empty lines are removed instantly; copy or download the result.

Are lines with only spaces removed?

Yes, by default. Turn off “Lines with only spaces count as empty” to keep them.

Can I keep paragraph breaks?

Yes. Choose “Keep one between paragraphs” to reduce multiple blank lines to one instead of removing them all.

Does it work with Windows line endings?

Yes. CRLF and LF line endings are both handled and kept as they were.

esc
↑↓ navigate↵ open