Remove extra spaces from text

Paste your text and fix its spacing: repeated spaces become one, spaces at the start and end of lines disappear, and odd space characters turn into normal ones.

  • Free
  • No sign-up
  • Runs in your browser
remove-extra-spaces

100% private — your text is processed in your browser and never sent to any server.

How it works

Paste your text

From a web page, a PDF, a document or an email.

Choose the clean-up

Tidy the spacing, remove every space or join all lines into one.

Copy the result

Paste the tidy text wherever you need it.

Spaces you cannot see cause visible problems

Extra spaces are easy to overlook and surprisingly costly. A double space between words looks sloppy in a published text. A space at the end of a name stops a lookup from matching in a spreadsheet. Spaces before a comma break the look of a paragraph, and a "space" that is actually a non-breaking space refuses to be found by a search. This tool normalises all of them in one step.

What "tidy spaces" does

  • Replaces runs of two or more spaces or tabs with a single space.
  • Removes spaces and tabs at the start and end of every line.
  • Turns unusual space characters (non-breaking space, thin space, ideographic space and similar) into a normal space. These often come from web pages and word processors and behave differently from a regular space when you search or compare text.
  • Optionally turns tabs into spaces, and optionally fixes the spacing around punctuation by removing spaces before commas, full stops, colons and question or exclamation marks, and adding a space after a comma or semicolon that is stuck to the next word.

Remove every space

The second action deletes all spaces, tabs and non-breaking spaces while keeping the line breaks. It is what you need for a phone number written as 612 34 56 78, a bank account number copied with groups, a code that should not contain spaces or a string you want to compare without spaces.

Join all lines into one

The third action replaces every line break, together with the spaces around it, with a single space. It is a quick way to turn a text that was wrapped at a fixed width into one continuous paragraph.

What it does not do

The tool works on characters, not on meaning. The punctuation option follows simple rules and is designed for ordinary prose; check the result if your text contains code, decimal numbers, URLs or languages with their own spacing conventions. Spaces inside quoted strings and code are treated like any other spaces. To remove blank lines as well, use the remove empty lines tool.

Frequently asked questions

How do I remove double spaces from a text?
Paste it and leave "Tidy spaces" selected. Every run of spaces or tabs becomes a single space and the ends of each line are trimmed.
Why does a space not get removed by search and replace?
It is probably a non-breaking or other unusual space character. "Tidy spaces" converts those to normal spaces first, so they can be collapsed.
How do I remove all the spaces from a text?
Choose "Remove every space". Spaces, tabs and non-breaking spaces are deleted; line breaks are kept.
Can I turn line breaks into spaces?
Yes. "Join all lines into one" replaces every line break with a single space.
Does it fix spaces before commas?
Yes, with the option "Fix spaces around , ; . : ! ?". It removes spaces before those marks and adds one after a comma or semicolon that touches the next word.
Is my text uploaded anywhere?
No. It is processed in your browser.