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
- Paste text that has inconsistent spacing.
- Pick which cleanups to apply, collapse spaces, trim lines, convert tabs.
- 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
Extra spaces: before and after by source
| Where the text came from | Typical mess | After cleaning |
|---|---|---|
| PDF copy | Invisible trailing spaces at every line end | Lines end at the last visible character |
| Typewriter-era habits | Two spaces after every period | One space, matching APA, Chicago and AP style |
| Spreadsheet paste | Tabs between what used to be columns | Single spaces, with the tab option on |
| Email or forum quote | Runs of spaces faking alignment | Each run collapsed to one space |
| OCR scan | Random double spaces mid-sentence | Even single spacing throughout |
| Web page copy | Non-breaking spaces between words | Left 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.