Tidy blank lines Text Tools
Runs in your browser
English

Tidy up extra blank lines

Tidy stretches of blank lines in your text and keep the regular breaks between lines.

You can count lines with only whitespace as blank, too. Your browser does the work.

Your browser tidies the text without sending it to a server.

What you can do here

If pasted text has too many blank lines, keep just one or two in a row or remove them all. The breaks between lines of text stay as they are.

How to use

  1. Paste the text you want to tidy.
  2. Choose how many blanks can stay in a row. Decide whether to count lines with only whitespace as blank.
  3. Select “Tidy blank lines,” then copy or save the result.

Examples to try

Keep up to one blank line

Input

Paragraph 1\n\n\nParagraph 2\n\n\n\nParagraph 3

Output

Paragraph 1\n\nParagraph 2\n\nParagraph 3

Remove every blank line

Input

A\n\n\nB\n\nC

Output

A\nB\nC

Tidy lines that contain only spaces or tabs

Input

Heading\n(space-only line)\n(tab-only line)\nBody

Output

Heading\n\nBody

Terms used in this tool

Blank line

A line with nothing on it. You can also count lines that contain only whitespace as blank.

Runs of blank lines

Here this means a run of blank lines. Regular breaks between lines of text stay in place.

LF / CRLF

These are two ways to mark the end of a line. The web and Unix systems often use LF. Windows editors often use CRLF.

FAQ

What happens to regular line breaks?

The default setting keeps regular line breaks and reduces runs of blank lines. Choose “Remove all blank lines” to remove every blank line.

Does a line with just spaces count as blank?

Yes. By default, a line counts as blank if it contains only spaces, tabs, non-breaking spaces, or fullwidth spaces.

Can I remove blanks before or after the text?

Yes. Under “Blank lines at the start and end” in the extra settings, choose whether to keep or remove them.

Can I choose CRLF for Windows?

Yes. Find “Line breaks in the result” in the extra settings and choose LF or CRLF.

What happens to the text I paste?

Your browser tidies the text without sending it to a server.

Notes

  • Use this to tidy blank lines. Regular line breaks stay in place, so the tool won't join lines in a paragraph.
  • Turn off “Count whitespace-only lines as blank” to keep lines that contain only spaces.
  • When “Trim whitespace at the end of lines” is off, the result may contain spaces that are hard to see.