Remove Extra Spaces

Remove extra spaces the moment you paste: repeated spaces collapse into one, spaces at the start and end of each line are trimmed, and tabs can become single spaces. The cleaned text updates live as you type, with a character count that shows exactly how much was removed.

Remove Extra Spaces tool

How to use it

  1. Paste text that has inconsistent spacing.
  2. Pick which cleanups to apply, collapse spaces, trim lines, convert tabs.
  3. Copy the tidied text.

What is extra whitespace?

Extra whitespace is any spacing beyond the single spaces that separate words: doubled spaces, tabs, and invisible spaces trailing at the ends of lines. This tool removes extra spaces in three switchable steps.

1. tabs → single space (optional)
2. runs of 2+ spaces → one space
3. trim spaces at the start and end of every line

Line breaks are never touched, so paragraphs and lists keep their shape. Only the ordinary space (U+0020) and the tab are affected; a non-breaking space is a different character and stays put on purpose, since Word and web pages insert it to hold two words together. A single space between words is never removed.

Worked example

Input: ‘hello world ’
Result: hello world

Extra spaces: before and after by source

Where the text came fromTypical messAfter cleaning
PDF copyInvisible trailing spaces at every line endLines end at the last visible character
Typewriter-era habitsTwo spaces after every periodOne space, matching APA, Chicago and AP style
Spreadsheet pasteTabs between what used to be columnsSingle spaces, with the tab option on
Email or forum quoteRuns of spaces faking alignmentEach run collapsed to one space
OCR scanRandom double spaces mid-sentenceEven single spacing throughout
Web page copyNon-breaking spaces between wordsLeft alone by design; swap them via find and replace

Why spacing gets messy

Copying between apps leaves behind extra spaces you cannot see: double spaces after periods from a typewriter habit, tabs from a spreadsheet, trailing spaces at the end of lines, and runs of spaces used to fake alignment in an email. They throw off character counts, break exact-match searches, and look uneven once the text lands in a proportional font.

The tool works in three steps that you can switch on or off. Tabs are converted to a single space first, if you ask for it. Then any run of two or more spaces is collapsed to one. Finally, spaces at the start and end of each line are trimmed. Line breaks are never touched, so paragraphs and lists keep their shape; use the remove line breaks tool if the lines themselves need joining.

One space or two after a period?

One. The two-space rule dates from typewriters, where every character was the same width and the extra space helped the eye find a sentence end. Proportional fonts make that unnecessary, and the current editions of the APA, Chicago and AP style guides all call for a single space. If a document mixes both, collapse them here rather than hunting for them by hand.

Spaces the tool leaves alone

Only the ordinary space (U+0020) and the tab are affected. A non-breaking space, which web pages and Word documents insert to keep two words together, is a different character and stays put, as do the zero-width and other invisible characters listed on the invisible character page. If a stubborn gap remains after cleaning, paste the text into the find and replace tool with Regex on, search for \u00a0 and replace it with a normal space.

Common uses

  • Cleaning text pasted from PDFs and the web
  • Fixing double spaces after periods
  • Trimming trailing spaces before saving
  • Preparing text for import into a spreadsheet
  • Normalizing spacing in code comments and commit messages
  • Tidying product descriptions before uploading to a store

When to use it

  • You want to remove double spaces after periods across an old document in one pass.
  • Text pasted from a PDF is full of extra spaces that need cleaning before it goes into a report or email.
  • Trailing spaces are tripping a code linter or bloating a commit diff.
  • A pasted table should become space-separated text before importing to a spreadsheet.
  • You need to remove extra spaces from product descriptions before a bulk upload to a store.

Related tools

Remove Line Breaks handles the breaks this tool deliberately leaves alone, joining short lines into paragraphs.

Find and Replace Text catches the stragglers, such as non-breaking spaces, with a quick regex search for \u00a0.

Word Counter confirms the cleaned text now counts the way the destination will count it.

Frequently asked questions

No. It only cleans spaces and tabs, so every line break stays where it was and your paragraphs and lists keep their shape. To join lines into paragraphs, use the remove line breaks tool, then bring the result back here if the spacing still needs work.
No. It collapses runs of two or more spaces down to a single space, so words stay separated. A single space is never removed unless it sits at the very start or end of a line and the trim option is on.
Yes. Turn on ‘Convert tabs to a single space’ to replace each tab character with one space; with the collapse option on, several tabs in a row become one space. Leave it off if the tabs are meaningful, for example in data you plan to paste into a spreadsheet.
Yes. Every run of two or more spaces becomes one, including the pair after a period. That matches the single-space rule in the current APA, Chicago and AP style guides. If you actually want two spaces after sentences, leave ‘Collapse multiple spaces’ off and use only the trim option.
It is probably a non-breaking space or another invisible character, which the tool leaves alone on purpose because it is not the ordinary space. Web pages and Word documents insert them to keep words together. Use the find and replace tool with Regex on, search for \u00a0, and replace it with a space.
Use the TRIM function: =TRIM(A1) removes leading and trailing spaces and collapses repeated spaces between words to one, the same as this tool's first two options. Excel's TRIM ignores non-breaking spaces; wrap it as =TRIM(SUBSTITUTE(A1,CHAR(160)," ")) to catch those as well.
Yes, downward. The status line under the result shows the new total. Trailing spaces in particular often add dozens of characters to pasted text without any visible difference, which matters when you are working against a limit such as an SMS segment or a meta description.