Remove Extra Spaces

ToolText · updated 5 October 2026

Two spaces, three spaces. And a hyphen- ated word.

Characters: 58 → 51

The fields work with JavaScript on. Above is a worked example.

Paste text into the “Text” field: the cleaned text appears in “Result”, and the line under it shows how many characters there were and how many are left. Each switch applies at once; turn off the ones you do not need.

What each switch does

On by default:

  • Double spaces → one. Two or more spaces in a row become one.
  • Spaces at line ends. Spaces at the start and end of every line are removed.
  • Non-breaking, thin and figure spaces → normal. The non-breaking space (U+00A0), the figure space (U+2007), the thin space (U+2009) and the narrow no-break space (U+202F) become ordinary spaces.
  • Tabs → space. Every tab becomes a space.
  • Extra empty lines. Three or more line breaks in a row become two: paragraphs stay separated by one empty line.

Off by default:

  • Join words broken at line ends (from PDF). A letter, a hyphen at the end of a line and a letter on the next line are joined: “hyphen-” and “ated” become “hyphenated”.
  • Everything on one line. Line breaks become spaces.

Where non-breaking spaces come from

A non-breaking space looks like an ordinary one but keeps two words on the same line. In Word it is typed with Ctrl+Shift+Spacebar, and web pages use it as the HTML entity  , so text copied from a document or a site often brings it along. Microsoft’s help warns that such spaces “can sometimes cause unexpected results when you sort, filter, or search”, and that Excel’s TRIM function removes only the ordinary space, not the non-breaking one.

Text copied from a PDF

A PDF keeps line breaks where each line on the page ended, and words split across two lines come out with a hyphen: “hyphen-” on one line and “ated” on the next. Turn on “Join words broken at line ends”, and also “Everything on one line” if the paragraph should be one line again: broken words are joined first, then the lines are merged.

Questions

Why does Excel's TRIM leave some spaces in place?
TRIM removes only the ordinary space, character 32. The non-breaking space, character 160, which web pages use as the HTML entity  , is not removed — Microsoft's own help says so. The switch "Non-breaking, thin and figure spaces → normal" turns it into an ordinary space, and the other switches then clean it up.
Why is there no typography option here?
The typography rules — «angle quotes», dashes and a non-breaking space after short prepositions — are Russian rules, and applied to English text they would do harm. They are only in the Russian version of the tool.
Will joining broken words also join real hyphenated words?
Yes, if the hyphen falls exactly at the end of a line: a word like "well-known" split as "well-" and "known" becomes "wellknown". The switch is off by default; check the result after turning it on.
Is my text sent anywhere?
No. The text is cleaned in your browser; it is not sent to a server and not saved.

Sources and date checked