Remove Extra Spaces
Clean up text with doubled spaces, stray spaces at the start or end of lines and runs of blank lines. Single spaces between words and your line breaks are kept.
Repeated spaces between words always become a single space. Line breaks and single spaces are kept, so paragraphs stay intact.
How to Use the Remove Extra Spaces
- Paste the text you want to clean into the input box.
- Keep "Trim spaces at the start and end of each line" on to remove indentation and trailing spaces.
- Choose how to handle blank lines: keep one between paragraphs, remove them all, or leave them unchanged.
- Copy the cleaned text from the result panel, or click Reset to start again.
Example
- Input
- Hello world. This is a test.
- Output
- Hello world. This is a test.
About the Remove Extra Spaces
Extra spaces creep in when text is copied from PDFs, emails, web pages or old documents. They make text look uneven, break search and comparisons, and can cause problems when the text is pasted into forms, code or spreadsheets.
Any run of two or more spaces between words becomes a single space. Non-breaking spaces are treated as normal spaces, and tabs are too unless you turn that option off. Line breaks are never joined, so paragraphs and lists keep their structure. With "Keep one blank line", runs of blank lines shrink to one and blank lines at the very start and end are removed.
The calculation runs in your browser with JavaScript, and this tool does not send what you enter to a Usevanta server.
Frequently Asked Questions
Will this join my lines or paragraphs together?
No. Line breaks are kept. Only repeated spaces within a line are collapsed, and blank lines are handled by the option you choose.
Does it remove spaces between words?
It never removes a single space between words. It only shortens runs of two or more spaces to one.
What happens to tabs?
With "Treat tabs as spaces" on, tabs become a single space like any other extra spacing. Turn it off to keep tabs, which is useful for tab-separated data.
Can I keep indentation at the start of lines?
Yes. Turn off "Trim spaces at the start and end of each line". Repeated spaces will still be collapsed to one.
Is my text uploaded?
The calculation runs in your browser with JavaScript, and this tool does not send what you enter to a Usevanta server.
Related Tools
All text tools →Remove repeated lines from lists and keep the first occurrence.
Sort lines of text alphabetically or by length, with options to remove blanks and duplicates.
Count words, characters, sentences and estimated reading time instantly.
Convert text to uppercase, lowercase, title case, sentence case or alternating case.