Collapse multiple blank lines in a list

Paste a list with irregular blank-line spacing and cap every run of consecutive blank lines at `N` (default 1). Runs of 2+ blanks get compressed; runs of `N` or fewer are left alone. Line endings are normalised to `\n` so CRLF input produces clean output.

Input
Ready
Output
Live

A blank-line compressor

The tool looks for runs of `N+2` or more newline characters in a row and replaces each run with exactly `N+1` newlines - which is `N` blank lines between items. So with `N = 1` (the default), three or more consecutive blank lines become one; with `N = 2`, four or more become two; and so on.

Line endings are normalised first. Windows CRLF (`\r\n`) and old Mac CR (`\r`) are converted to Unix `\n` before the collapse pattern runs. That means a mixed-ending paste produces cleanly consistent output. If you need CRLF in the output for a specific consumer, post-process with a line-ending-conversion tool.

Items themselves are not touched - no trimming, no case changes, no dedup. Only the blank lines between items are compressed. If you also need to clean up leading/trailing whitespace or remove duplicates, chain with trim, Remove empty items, or Dedupe.

How to use collapse multiple blank lines in a list

  1. 1Paste your list into the input panel
  2. 2Set Keep at most N blanks to the maximum blank-line run you want to allow (default 1)
  3. 3Runs longer than that get compressed; shorter runs pass through unchanged
  4. 4Copy or download the result from the output panel

Keyboard shortcuts

Drive ListShift without touching the mouse.

Shortcut Action
Ctrl ZUndo last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor
EscExit fullscreen
Ctrl KOpen the command palette to jump to any tool
Ctrl SSave current pipeline draft Plus
Ctrl PRun a saved pipeline Plus

What this tool actually does

One option, a couple of fixed normalisations.

Caps consecutive blank lines at N

Every run of `N+2` or more newlines in a row is replaced with `N+1` newlines (= `N` blank lines between content). Shorter runs are not touched, so lists with already-tidy spacing pass through unchanged.

CRLF normalisation

Before the collapse, `\r\n` and bare `\r` are converted to `\n`. That way a mixed Windows/Unix paste produces consistent output. Most downstream tools prefer `\n` anyway.

Items are not modified

Only blank lines are compressed. Item content is emitted verbatim - no trimming, no dedup, no reordering. This tool does one thing.

Setting N to 0 removes all blank lines

With Keep at most 0 blanks, the tool collapses every run of `\n\n` or more down to a single `\n`. That is equivalent to dropping every blank line in the list.

The reverse operation

To add uniform spacing to a list that currently has none (or inconsistent spacing), use Add line breaks instead. This tool is for reducing; that one is for adding.

Worked example

With `N = 1`, runs of 2 or 3 blanks collapse to a single blank line.

Input
Apples


Oranges

Cherries



Plums
Output
Apples

Oranges

Cherries

Plums

Settings reference

How the cap value shapes the output.

Setting What it does Effect on the sample
Keep at most 1 blank (default) Collapses runs of 2 or more blank lines down to exactly 1 All gaps become a single blank line
Keep at most 2 blanks Collapses runs of 3 or more down to 2; 0-2 blank runs unchanged Two-blank gaps pass through; the three-blank gap compresses to two
Keep at most 0 blanks Removes every blank line - effectively drops all empty separators Four items stacked with no spacing between them
CRLF normalisation (automatic) `\r\n` and `\r` are converted to `\n` before collapsing Windows pastes produce Unix-style output

FAQ

What is the difference between `N = 0` and `N = 1`?
`N = 0` removes every blank line - items stack directly. `N = 1` keeps a single blank line between items when there was at least one blank in the source. Pick `0` when you want everything adjacent, `1` (default) when you want tidy but spaced.
Does the tool handle Windows line endings?
Yes. CRLF (`\r\n`) and bare CR (`\r`) are normalised to Unix LF (`\n`) before the collapse runs. The output uses `\n` line endings. If a downstream consumer requires CRLF, post-process separately.
Does this tool trim or modify my items?
No - only blank lines between items are touched. Item content passes through verbatim. For whitespace cleanup inside items, use trim; for duplicate removal, Dedupe.
What happens if my input has no blank lines?
The output equals the input (modulo line-ending normalisation). The tool only collapses runs of 2 or more blanks; shorter runs pass through unchanged.
What is the reverse operation?
Use Add line breaks to insert uniform spacing between items. That tool drops every existing blank line first, then inserts `N` new blanks between each pair of items.