Remove Extra Spaces
Collapse double spaces, strip trailing whitespace and tidy text.
Remove Extra Spaces
Instant online text processing
What does Remove Extra Spaces do?
Clean up spacing problems in one pass: collapse runs of spaces, trim each line, remove blank lines, and replace invisible non-breaking spaces with ordinary ones. These are the artefacts that survive copying from a PDF or website.
How to Use Remove Extra Spaces
- 1Paste your textStraight from a PDF or web page is fine.
- 2Pick the fixesEach option can be switched on independently.
- 3Copy the clean textThe character saving is shown above.
Key Features
- Collapse runs of two or more spaces into one
- Trim leading and trailing whitespace from every line
- Remove blank lines, or collapse several into one
- Replace non-breaking and other invisible Unicode spaces
- Convert tabs to spaces at a width you choose
- Shows how many characters were removed
Frequently Asked Questions
Why does text copied from a PDF have odd spacing?
PDFs position each glyph individually rather than storing flowing text. Extractors insert spaces where they detect gaps, which produces double spaces, broken words and stray line breaks.
What is a non-breaking space?
The character U+00A0, used in HTML as to stop a line breaking at that point. It looks like a space but does not match a normal space in a search, which causes hard-to-find bugs. This tool converts them.
Should there be one or two spaces after a full stop?
One. The two-space convention comes from monospaced typewriters and every current style guide has dropped it. Proportional fonts already space sentences correctly.
Will this remove indentation from my code?
Line trimming would, so switch it off if indentation matters. Collapsing internal runs of spaces is generally safe for code except inside strings.
Everything you paste stays in this page. Text tools run as JavaScript in your browser, so nothing is uploaded, logged or stored.
Related Tools
Text Cleaner
Strip formatting, HTML, smart quotes and invisible characters.
Remove Line Breaks
Join broken lines back into flowing paragraphs.
Remove Duplicate Lines
Strip repeated lines from a list, with a count of what went.
Sort Lines
Sort a list alphabetically, numerically, by length or randomly.
