Remove Extra Spaces
Collapse multiple spaces and tabs to single spaces and trim each line, while keeping line breaks. Paste messy text and copy it clean. Free.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
Remove Extra Spaces
Collapse multiple spaces and trim each line down to single spacing.
Remove Extra Spaces deletes repeated spaces from pasted text and lets you decide exactly which other whitespace goes with them: tabs converted to a single space, Unicode look-alike spaces such as the non-breaking space normalised, zero-width characters deleted, every line trimmed, blank lines collapsed or removed, and spacing around punctuation tightened. Eleven independent switches plus three one-click presets mean the paragraph layout you want to keep survives while the mess disappears. A before-and-after table counts characters, words, lines and blank lines on both sides so you can see what changed, and everything runs as JavaScript in your browser tab — no upload, no account, no size limit imposed by a server.
How to use Remove Extra Spaces
Paste text into the Input box, which loads the sample This has too many spaces with runs of extra spaces between the words
The Result box collapses every run of spaces and tabs on a line into a single space and trims leading and trailing spaces from each line
Line breaks are kept as they are, so paragraphs and blank lines stay where they were; only the spacing within each line changes
Click Copy above the Result box to copy the cleaned text, or use Clear and Load sample on the Input box to start over
Why use Remove Extra Spaces
Every rule is optional
Repeated spaces, tabs, Unicode spaces, zero-width characters, line trimming, blank lines, line endings and punctuation spacing are separate switches, so you never lose formatting you wanted to keep just to fix something else.
Catches spaces you cannot see
Non-breaking, en, em, thin and ideographic spaces are normalised to a plain space, and zero-width joiners, direction marks, soft hyphens and the byte-order mark can be deleted outright — the usual reason two identical-looking strings refuse to match.
A before-and-after count, not a guess
A table shows characters, characters without spaces, words, lines and blank lines for the input and the output side by side, with the change on each row, so the effect of a switch is visible before you copy anything.
Conservative punctuation handling
Adding a missing space after punctuation only fires before a letter, and after a full stop only before a capital, so decimals like 3.14, clock times like 12:30 and abbreviations like e.g. are not broken.
Common use cases
- You copied a paragraph out of a PDF and it arrived with double spaces after every full stop, tabs mid-sentence and a space in front of each comma before you paste it into a CMS.
- A column of names exported from a spreadsheet has leading spaces and non-breaking spaces on some rows, so de-duplication and VLOOKUP keep failing on values that look identical on screen.
- You are flattening scraped product descriptions into one clean value per line and need indentation gone, blank rows dropped and Windows CRLF endings normalised in a single pass.
Frequently asked questions
Does it remove line breaks or blank lines?
No. Every newline is kept, so a blank line stays a blank line and the number of lines in the output matches the input. Only spaces, tabs and other blank characters within a line are affected.
Link to answerWill it collapse the double space after a full stop?
Yes, with “Collapse repeated spaces” on, which it is by default. Any run of two or more spaces becomes one, including the traditional double space after sentence-ending punctuation that most modern style guides no longer use.
Link to answerWhy do two lines still look different after cleaning?
Almost always a non-breaking space or a zero-width character. Those are separate Unicode code points that render as a space or as nothing at all, so a normal space-collapsing pass ignores them. Turn on “Normalise Unicode spaces” and “Delete zero-width characters” and compare again.
Link to answerWhat about non-breaking spaces copied from a web page?
They are cleaned up too. Non-breaking spaces (the that web pages and Word documents paste in), ideographic spaces and stray carriage returns count as whitespace, so each run of them becomes one ordinary space and any at the start or end of a line is trimmed — two lines that look identical then also compare as identical.
Link to answerIs my text uploaded to a server?
No. The clean-up is plain JavaScript running in the page, so the text stays on your device, nothing is logged, and the tool keeps working if you go offline after the page has loaded.
Link to answer