TextyConverterbeta
⌘K

Collapse Blank Lines

Limit runs of consecutive blank lines to at most N (default: 1). Browser-only.

About Collapse Blank Lines

This tool keeps blank lines but limits how many appear in a row. A file with paragraphs separated by 4 blank lines becomes one with paragraphs separated by 1 (or whatever N you choose). Useful for tidying documents that have grown loose with edits.

When to use it

  • Tightening a draft where extra blank lines have accumulated
  • Normalizing paragraph spacing before publishing
  • Cleaning text output that double-spaces between blocks
  • Pre-processing for a renderer that's sensitive to blank-line count

How it works

The text is processed line by line. A counter tracks consecutive blank lines; once N blanks have been emitted, additional blanks are dropped until a non-blank line resets the counter.

Examples

foo



bar


baz (N=1)
foo

bar

baz

Frequently asked questions

Are leading and trailing blank lines preserved?
They're subject to the same limit. If N=1, you can have at most 1 leading blank line and 1 trailing blank line.
What counts as 'blank'?
A line whose trimmed content is empty — including lines that contain only whitespace.
How does this differ from remove-empty-lines?
Remove-empty-lines drops every blank line. Collapse-blank-lines keeps up to N in a row, so paragraph breaks survive.

Related tools