Skip to content

Remove Extra Spaces

Clean up double spaces, trailing whitespace and blank lines.

Updated · Examples checked by automated tests

LOCAL WORKSPACENO UPLOAD REQUIRED

0 characters

Cleaned text

The cleaned version appears here.

About Remove Extra Spaces

Text copied from PDFs, web pages and word processors arrives full of invisible clutter: double spaces after full stops, non-breaking spaces, hard tabs and rows of empty lines.

This cleaner normalises all of it in one pass, with each transformation as a separate toggle so you keep exactly the formatting you want and drop the rest.

How Remove Extra Spaces works in your browser

Each clean-up is a separate option: collapse repeated spaces, trim leading and trailing whitespace, convert tabs to spaces and collapse runs of blank lines. Line breaks are kept unless you choose to collapse all whitespace into a single line.

Non-breaking spaces and zero-width characters — common when copying from web pages and word processors — are normalised as well.

When to use it

  • Cleaning text copied from a PDF before pasting it elsewhere.
  • Removing double spaces from a document.
  • Stripping invisible characters that break search or comparisons.

Worked examples

Clean text pasted from a PDF

Settings: Default options

Input

  Total		amount:   1,200  



  Due:  Friday 

Expected output

Total amount: 1,200

Due: Friday

Tabs become spaces, repeated spaces collapse to one, each line is trimmed, and runs of blank lines shrink to a single blank line.

Join wrapped lines into one

Settings: Default options plus Join into one line

Input

The quick brown
fox jumps over
  the lazy dog.

Expected output

The quick brown fox jumps over the lazy dog.

Join into one line replaces every line break and run of whitespace with a single space, which helps when text was hard-wrapped in an email or PDF.

Limits and checks before you use the result

  • Do not use it on code, Markdown tables or poetry where indentation and spacing carry meaning.
  • Non-breaking and zero-width spaces are normalised by default; turn that option off if you need them preserved.
  • It does not fix spacing around punctuation, such as a space before a comma.

Frequently asked questions

What exactly is removed?

Whichever options you enable: repeated spaces collapse to one, leading and trailing whitespace goes, tabs convert to spaces and repeated blank lines collapse.

Are line breaks preserved?

Yes, unless you explicitly choose to collapse all whitespace, in which case the text becomes a single line.

Does it remove invisible characters?

Yes. Non-breaking spaces and zero-width characters, which often sneak in from web pages and word processors, are normalised too.

Guides

Related tools