Skip to content

Tool 34 / Format lines

Less air between the lines.

Remove blank lines, clean up whitespace-only rows, or collapse a run of gaps into a single paragraph break. Whole-line cleanup that leaves the words alone.

  • Free to use
  • Blank-line cleanup
  • Runs locally
Live workbench4 lines removed

Collapsing runs is different from deleting every blank line. It keeps one separator between paragraphs and removes the extras, including blank lines at the very start and end of the input.

Text without empty lines

What counts as empty

With “treat spaces and tabs as empty” on, a line containing only indentation is empty. With it off, only a line with no characters at all is removed, and an indented blank line survives. That distinction matters in code, where indentation can be structural.

This tool removes whole lines. It does not remove spaces inside a line, and it does not treat a CSV field that happens to be empty as an empty row.

8 lines in4 lines removed4 lines out116 characters outBlank-line cleanup · never uploaded

What it does

This tool removes lines that contain nothing, or nothing but spacing. It works on whole lines, so it does not delete spaces between words or empty fields inside a row. Paste a document, a list, a log excerpt, or a copied spreadsheet, and the result is the same text with the empty rows taken out.

Empty lines are useful in prose and code, and they are also the first thing that breaks when text moves between systems. A PDF copy adds a blank line after every visual line, a chat message doubles the gaps, and a CSV export leaves a trail of empty rows. Removing them is usually a formatting decision, not a content decision, which is why the words and their order stay untouched.

Blank vs whitespace-only

A truly empty line has no characters between two line breaks. A whitespace-only line contains spaces, tabs, or another kind of invisible spacing. The difference matters. In Markdown, a line containing a few spaces can still be a paragraph separator or a hard break. In Python, indentation is syntax. In a table copied from a web page, a line of spaces may be a visual gap rather than a missing row.

Turn on “treat spaces and tabs as an empty line” when you want the aggressive version. Turn it off when indentation is part of the content. The tool shows how many lines it removed and how many remain, so you can compare the count with what you expected before copying the result.

Collapse or delete

Deleting every blank line is the right choice for a list or a log. Collapsing runs is better for prose, where one blank line means “new paragraph” and five blank lines mean “the paste went wrong.” Collapse keeps one separator per run, removes extra separators, and trims blank lines from the beginning and end.

The two modes answer different questions. “Delete” asks, “What text is left if I remove every empty row?” “Collapse” asks, “How do I keep the paragraph structure without the noise?” If the output is going back into a document, collapse is usually the gentler option.

Examples

Delete every blank and whitespace-only line
Whitespace-only option on · trim off

Before

First heading

A paragraph with a blank line before it.
   
Another paragraph after a whitespace-only line.


A final note.

After

First heading
A paragraph with a blank line before it.
Another paragraph after a whitespace-only line.
A final note.

All four gaps disappear: the empty line after the heading, the line containing spaces, the double blank line, and the final trailing separator. The words and their order are unchanged. Because trimming is off, any indentation on the remaining lines would survive.

Collapse runs into one paragraph break
Collapse option on · whitespace-only lines treated as empty

Before

First heading

A paragraph with a blank line before it.
   
Another paragraph after a whitespace-only line.


A final note.

After

First heading

A paragraph with a blank line before it.
Another paragraph after a whitespace-only line.

A final note.

The single gap after the heading is already a paragraph break, so it stays. The whitespace line becomes a normal separator, the double gap becomes one, and the trailing gap is removed. The result is shorter without losing the distinction between paragraphs.

Limits worth knowing

  • It edits lines, not records. A CSV row with empty fields is not an empty line. A quoted field containing a line break is treated as separate lines, because this tool does not parse CSV semantics.
  • Trimming can break indentation. Turning on “trim spaces from the lines that remain” also removes the leading spaces on non-empty lines. That is useful for pasted prose and destructive for code, YAML, and nested lists.
  • Blank lines can carry meaning. In Markdown, a blank line separates blocks. In source code, it separates functions. In poetry, it separates stanzas. Keep a copy of the original if the layout is part of the work.
  • Line endings are normalized. CRLF and CR are converted to LF. Most systems accept LF, but a Windows-only pipeline may want the original convention back.
  • No undo beyond the browser. The tool does not store history. Copy the result before closing the tab, and keep the original if you may need to compare.

Page updated

Questions, answered

What is the difference between an empty line and a whitespace-only line?

An empty line has no characters between its line breaks. A whitespace-only line contains spaces, tabs, or other invisible spacing. The first is always removed. The second is removed only when you turn on the whitespace option, because indentation can be meaningful in code and poetry.

What does “collapse a run of empty lines” do?

It keeps one blank line between groups of text and removes the extra blank lines around it. For example, three blank lines become one. It also removes blank lines at the very start and end of the input, so the result does not begin or end with a stray separator.

Will this remove empty CSV fields?

No. It removes whole lines, not fields inside a line. A row like Ada,,London still has three fields and is kept. If you need to remove rows whose selected columns are all empty, use the delimited column extractor with its empty-row option.

Does trimming lines change indentation?

Yes. Trimming removes leading and trailing spaces from every remaining line, which will flatten indented code or nested list items. Leave it off when indentation matters. Removing empty lines and trimming spaces are separate operations for exactly that reason.

Which line endings are supported?

The tool normalizes Windows CRLF and old Mac CR line endings to LF before processing, then returns LF line endings. Browsers and most modern editors accept that. If a downstream system requires CRLF, convert the result after copying it.

Is the text uploaded?

No. The removal happens in this browser tab with JavaScript. There is no server request, account, or stored copy. The page does not know what you pasted after you close it.

All tools →