Remove Empty Lines

Delete every blank or whitespace-only line to compact your text — or collapse runs of blank lines down to one. Runs in your browser; nothing is uploaded.

Try:
Compacted text

About this tool

Remove Empty Lines deletes the blank lines from a block of text so the remaining lines sit together with no gaps. Paste your text, pick how blank lines should be handled, and copy the compacted result.

Everything runs locally in your browser via WebAssembly — your text is never uploaded.

Worked example

Input:

First line

Second line
   
Third line

With Remove all empty lines and Also remove whitespace-only lines on (the line with three spaces counts as empty), the output is:

First line
Second line
Third line

Switch the mode to Collapse consecutive blanks to one and the same input keeps one blank line between each entry instead of removing them all.

Handy for

Limits & edge cases

FAQ

What counts as an "empty" line?

By default, both a truly empty line and a line that contains only spaces or tabs count as empty and are removed. If you turn off Also remove whitespace-only lines, then only lines with zero characters are removed and a line of spaces is kept as-is.

What is the difference between "remove all" and "collapse"?

Remove all deletes every blank line, so the remaining content is packed together with no gaps. Collapse keeps a single blank line wherever there were one or more in a row — useful when you want to keep paragraph breaks but get rid of triple- and quadruple-spaced gaps.

Will it change the non-blank lines or their order?

No. The order of your content is preserved exactly. Non-blank lines are left untouched unless you tick Trim leading/trailing whitespace on kept lines, which strips spaces and tabs from the start and end of each remaining line.

Is my text uploaded anywhere?

No. The tool runs entirely in your browser as WebAssembly — the text you paste never leaves your device.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool remove-empty-lines "Paste text with blank lines to remove…"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/remove-empty-lines/?text=Paste%20text%20with%20blank%20lines%20to%20remove%E2%80%A6&mode=remove&whitespace_only=true&trim_lines=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.