Remove Extra Spaces
Get rid of double spaces, leading indentation and trailing spaces without touching your line breaks.
Your text stays in this browser tab. Nothing is uploaded, saved or logged.
How the Remove Extra Spaces works
Any run of two or more horizontal whitespace characters (spaces, tabs and the special Unicode spaces such as the non-breaking space) is replaced by one ordinary space. A single space or tab between words is not touched, because it is not “extra”.
With trimming on, spaces at the start and end of every line are also removed. Line breaks are preserved, so paragraphs and lists keep their structure; Windows line endings are converted to standard ones.
To convert single tabs and non-breaking spaces into normal spaces, or to remove invisible characters such as the zero-width space, use Normalize Whitespace. To delete blank lines, use Remove Empty Lines.
How to use it
- Paste your text.
- Choose whether to trim the start and end of each line.
- Copy the cleaned text.
Example
Runs of spaces collapse to one and each line is trimmed.
Input
Hello world, this has extra spaces. Indented line with gaps
Result
Hello world, this has extra spaces. Indented line with gaps
Frequently asked questions
Will it remove indentation in code or poetry?
With trimming on, yes, leading spaces on every line go. Turn trimming off to keep indentation; double spaces inside lines will still be collapsed.
Why do some spaces remain after I run it?
Single spaces are left alone, and so is a single non-breaking space or tab. If gaps persist, they may be special characters; run Normalize Whitespace to convert them to ordinary spaces first.
Does it remove blank lines?
No, it keeps every line break. Use Remove Empty Lines to delete blank lines.