Home / Remove spaces

Remove spaces

Paste text to remove extra spaces: double spaces become one, and spaces at the start and end of lines go. Or remove every space.
Your text never leaves your device: everything runs in this page. No upload, no sign-up.

Your text

Empty

Without extra spaces

Which spaces to remove

ChoiceBeforeAfter
Remove extra spaces (default)  New   York New York
Trim line starts and ends  New  York New  York
Remove all spaces12 345 67812345678

No-break spaces (common in text from web pages and Excel) look like normal spaces but are not removed by Excel's TRIM or Google Sheets' Trim whitespace. Here they become normal spaces first, so they are cleaned too. Tabs become spaces by default.

In Excel, =TRIM(A1) removes extra spaces but not no-break spaces; =TRIM(SUBSTITUTE(A1, CHAR(160), " ")) handles both.

Why Excel's TRIM leaves some spaces behind

Excel's TRIM removes only the ordinary space character. The no-break space that web pages and many exports use is a different character, so TRIM keeps it, and Google Sheets' Trim whitespace keeps it too. This page turns no-break spaces into normal spaces before removing the extras. The details, with a test of which trim functions remove which characters, are in Hidden characters: why identical values do not match.

Related tools

Guides

Questions

How do I remove double spaces?

Paste the text. Remove extra spaces is selected, so every run of spaces becomes one.

How do I remove all spaces from a number or code?

Choose Spaces: Remove all spaces.

Why are some spaces not removed by Excel's TRIM?

They are no-break spaces (character 160). This page turns them into normal spaces before cleaning.