Remove Extra Spaces
Remove extra spaces from text online: collapse repeated spaces and tabs, trim lines and swap non-breaking spaces. Free, instant, in your browser.
How to use Remove Extra Spaces
- 1Paste your text or open a .txt file.
- 2Adjust the options if you want to keep indentation or leave Unicode spaces alone.
- 3Copy the cleaned text; the summary shows how many spaces were removed.
What makes it better
- Collapses spaces and tabs to one space
- Optional: keep leading indentation
- Converts non-breaking and ideographic spaces
- Tick other cleanup steps on the same page
About Remove Extra Spaces
Remove Extra Spaces turns runs of spaces and tabs into a single space and trims the spaces at the start and end of every line. It also converts non-breaking and other Unicode spaces into normal ones, which is the usual culprit when text pasted from the web or a PDF refuses to line up. Line breaks are left alone.
Common uses
- Tidy text pasted from a PDF, email or website that has uneven spacing.
- Fix double spaces typed after full stops before sending a document.
- Normalise data copied from a spreadsheet before pasting into a form.
- Strip trailing spaces from lines of code or configuration.
Example
Input
Hello world, this text has too many spaces. Indented line with a tab.
Result
Hello world, this text has too many spaces. Indented line with a tab.
Good to know
- Only spaces and tabs are collapsed; line breaks stay as they are. Use Remove Empty Lines or Remove Line Breaks for those.
- Line endings in the result are always plain line feeds, even if your text used Windows-style CRLF.
- Zero-width characters are not treated as spaces and are left in place.
Remove Extra Spaces FAQ
How do I remove double spaces between words?
Paste the text and leave Remove Extra Spaces ticked. Every run of two or more spaces or tabs becomes a single space, so double spaces after full stops disappear too.
Can I keep the indentation at the start of lines?
Yes. Turn on “Keep leading indentation” and the spaces or tabs at the start of each line are left as they are, while spacing inside the line is still collapsed.
What are non-breaking spaces and why convert them?
A non-breaking space looks like a normal space but is a different character, so searches and tidy-up tools miss it. Text from web pages and Word often contains them. This tool turns them into ordinary spaces first.
Does it remove blank lines as well?
Not by default. A line containing only spaces becomes an empty line. To delete empty lines entirely, tick “Remove empty lines” in the cleanup steps.
Is my text sent anywhere?
No. The cleaning happens inside your browser tab, so pasted text never leaves your device.