Remove Extra Spaces
Remove double spaces, spaces at the start and end of lines, tabs and extra blank lines in one click. The space remover also cleans up the invisible characters that come with copied text, such as non-breaking spaces and zero-width spaces, and can remove the space before a comma or full stop.
- Double spaces
- Invisible spaces
- Stays on your device
- Double spaces found
- 0
- Characters removed
- 0
- Characters after
- 0
- Lines
- 0
How to remove extra spaces from text
Remove spaces from text you’ve copied or typed in three steps with this space remover.
-
Paste your text
Text from a PDF, a spreadsheet, an email or a web page. The cleaned text appears next to it.
-
Choose what to clean
Double spaces, spaces at line ends, tabs, non-breaking and zero-width spaces are cleaned by default. Choose what happens to empty lines, and tick Remove spaces before punctuation if you need it.
-
Copy the result
Copy the cleaned text, download it, or press Use result as input to keep editing.
The sample has 66 characters, including 7 runs of two or more spaces. With the default options, 14 characters are removed and 52 are left: Too many spaces here , and tabs too., a blank line, then New paragraph.
Space remover features
Remove whitespace you can see and the invisible kind you can’t.
-
2→1
Double spaces
Any run of spaces between words becomes a single space.
-
| |
Ends of lines
Spaces and tabs at the start and end of every line are removed, and blank lines at the top and bottom go too.
-
NBSP
Invisible spaces
Non-breaking, thin and ideographic spaces become normal spaces; zero-width spaces are removed.
-
¶
Empty lines
Keep them all, keep at most one in a row, or remove them all.
What the space remover cleans
Each option and what it changes:
| Option | Before | After |
|---|---|---|
| Turn double spaces into one | Too␣␣␣many␣␣spaces | Too␣many␣spaces |
| Remove spaces at the start and end of lines | ␣␣New paragraph.␣␣ | New paragraph. |
| Turn tabs into spaces | and→tabs | and␣tabs |
| Turn non-breaking and other Unicode spaces into normal spaces | 100 km (U+00A0, no-break space) | 100 km (U+0020, normal space) |
| Remove zero-width spaces | zerowidth (U+200B between the words) | zerowidth |
| Remove spaces before punctuation | here␣,␣and | here,␣and |
| Empty lines: keep one in a row at most | 3 blank lines | 1 blank line |
␣ marks a space and → a tab. Zero-width spaces (U+200B), word joiners (U+2060) and byte order marks (U+FEFF) are removed; the joiners inside emoji and in scripts like Hindi are left alone.
How to remove double spaces
Double spaces creep in when you type two spaces after a full stop, when text is copied from a PDF, or when columns are pasted from a spreadsheet. Paste the text here and leave Turn double spaces into one on: every run of two or more spaces between words becomes one space. Single spaces are never removed, so your words don’t run together.
To see where the extra spaces are before you remove them, paste your text into the Whitespace Counter, which highlights every space, tab and invisible character.
Non-breaking spaces and other invisible characters
Some spaces look normal but aren’t. A non-breaking space (U+00A0) keeps two words on the same line, as in 100 km; web pages and word processors add them, and they come along when you copy. Others include the narrow no-break space (U+202F), the thin space (U+2009) and the ideographic space (U+3000) used in Chinese and Japanese.
These can break formulas, searches and sorting, because a program sees a different character from a normal space. To remove non-breaking spaces and the others, leave Turn non-breaking and other Unicode spaces into normal spaces on: it replaces them all with U+0020.
A zero-width space (U+200B) takes up no room at all, so you can’t see it, but it splits a word in two for search engines and spell checkers. Remove zero-width spaces deletes it, along with word joiners and the byte order mark (U+FEFF) that some files start with.
Remove extra spaces in Excel, Google Sheets and Word
- Excel:
=TRIM(A1)removes spaces at the start and end of a cell and turns double spaces between words into one. It only removes the normal space (character 32), not the non-breaking space (character 160), so for text copied from the web use=TRIM(SUBSTITUTE(A1,CHAR(160)," ")). - Google Sheets: select the cells and choose Data › Data cleanup › Trim whitespace. Non-breaking spaces are not trimmed this way either.
- Word: press Ctrl+H, type two spaces in Find what and one in Replace with, and press Replace All until Word finds no more.
For a whole document at once, paste it here: every kind of space is cleaned in one pass.
Does removing extra spaces change the word count?
No. Words are counted between spaces, so one space or five between two words makes no difference to the word count. Removing a zero-width space can change it, though: zerowidth with a hidden U+200B in the middle is two words to some tools and one word after cleaning.
The character count does go down, by one for every space, tab or invisible character removed. The Characters removed number shows exactly how many.
Remove extra spaces FAQ
How do I remove extra spaces from text?
Paste the text: double spaces, spaces at line ends, tabs and invisible spaces are cleaned straight away with the default options. Copy the cleaned text.
Does it remove the spaces between words?
No. One space is always kept between words; only the extra ones are removed.
Can I trim spaces at the start and end of lines?
Yes. Remove spaces at the start and end of lines is on by default and works on every line.
Will it remove line breaks?
No. Line breaks stay where they are. You choose whether empty lines are kept, limited to one in a row or removed. To join lines, use Remove Line Breaks.
Can it remove tabs?
Yes. Turn tabs into spaces replaces each tab with a space, and double spaces are then turned into one.
What are non-breaking and zero-width spaces?
Invisible characters that look like a normal space or like nothing at all. They often come with text copied from web pages and can break searches and formulas. The tool turns non-breaking spaces into normal ones and removes zero-width spaces.
Does removing spaces change the word count?
No, except when a hidden zero-width space was splitting a word in two. The character count goes down by the number of characters removed.
Is my text uploaded?
No. The cleaning happens in your browser and nothing is sent or stored.
Sources and references
- TRIM function, Microsoft Support
- Split text, remove duplicates, or trim whitespace, Google Docs Editors Help
- Whitespace character, Wikipedia
More text editing tools
- ¶ Remove Line Breaks Remove line breaks from PDF or email text, and keep paragraphs if you like. Open tool
- ·→¶ Whitespace Counter Count spaces, tabs and line breaks and find hidden zero-width characters. Open tool
- A→B Find and Replace Find words or phrases and replace them all, with whole-word and regex options. Open tool
- ≠ Remove Duplicate Lines Remove duplicate lines from a list and keep its order. Open tool