Collapse Whitespace

Collapse repeated spaces, trim each line, drop blank lines, or join lines. This does not delete every space the way Remove Space does.

One space where there were many

Copied text often has double spaces, a tab, a fullwidth space, or a blank line between paragraphs. This page can collapse those gaps, trim each line, drop empty lines, or join everything into one paragraph. It does not delete every space. A single space between words stays. If you want spaces gone entirely, use remove space. Trimming only the ends of the whole text is trim text. Dropping blank lines alone is remove empty lines. Joining with a separator you choose is join text.

How to use it

  1. Paste the text. The four options can be combined.
  2. “Collapse repeated spaces” is on by default. It turns runs of spaces, tabs, fullwidth spaces and non-breaking spaces into one ordinary space.
  3. “Trim each line” is on by default. It removes spaces at the start and end of each line, not the spaces between words.
  4. “Drop empty lines” removes lines that are empty after the trim. “Join lines into one paragraph” replaces line breaks with a space.
  5. The example a b, tabs, a blank line and d becomes a single spaced line when all four are on.

What counts as space

Collapse treats the ordinary space, tab, fullwidth ideographic space and non-breaking space as the same gap. It does not remove a line break unless you join lines. Newlines stay, so a poem can be tightened without becoming one paragraph. If every option is off, the text is unchanged.

Where people use it

  • Cleaning a paragraph pasted from a PDF or a web page.
  • Turning a ragged list into one line before you search it.
  • Removing the blank lines a mail client inserted, while keeping the words separated.

Questions

I wanted no spaces at all.

That is remove space. This page keeps one space so words do not run together.

A fullwidth space was still there.

Turn “Collapse repeated spaces” on. A single fullwidth space is a repeated run of length one and becomes a normal space.