Free tool · Writing tools
Remove extra spaces
Paste your text and every run of spaces shrinks to a single space. Leading and trailing spaces, tabs and blank lines can be cleaned too, and you see how much was removed.
- Free
- No sign-up
- Runs in your browser
- 15 characters removed
- Spaces inside lines
- 7
- Spaces at line edges
- 6
- Tabs and odd spaces fixed
- 1
- Empty lines dropped
- 2
- Characters
- 65 before, 50 after
How to use the Remove Extra Spaces
- Paste your text into Your text.
- Under Clean up, keep the ticks you want: Many spaces to one, Trim each line, Tabs to spaces, Odd spaces to normal.
- Choose what happens to Empty lines: keep them all, leave one in a row, or remove them.
- Check the counts, then press Copy.
How do I remove extra spaces from text?
Paste the text and leave the first two ticks on. Every run of two or more spaces becomes one space, and spaces at the start and end of each line disappear. "Thanks for the reply " comes back as "Thanks for the reply". The counts under the result tell you how many spaces went from inside the lines and how many from the line edges.
The cleanup works line by line. Your line breaks stay where they are, so a list, an address or a poem keeps its shape. If the real problem is that the text is cut into short lines, the remove line breaks tool joins them.
Why does my text have double spaces and strange gaps?
Double spaces come from habit (two spaces after a full stop), from copying out of a PDF or a web page, and from tables that were pasted as text. Many email programs also add trailing spaces at the end of lines without showing them.
Some gaps look like spaces but are different characters. A non-breaking space keeps two words on the same line, and word processors insert it in many places. A normal search for a space does not find it. The option Odd spaces to normal swaps these look-alikes, plus the thin and wide spaces from the Unicode set, for an ordinary space, so they can then be squeezed like any other. The count shows how many it found.
A tab is a separate character as well. It jumps to the next tab stop, so its width depends on the program. Tabs to spaces turns each tab into one space, and the squeeze then reduces a row of them to one gap.
What does each option do to the same line?
The line below has two spaces and a run of three at the start, a tab in the middle, and a non-breaking space near the end. A dot stands for a space, an arrow for a tab and a degree sign for a non-breaking space. The table shows the result when only one option is on, then when all are on.
| Options on | Result |
|---|---|
| None | ··Hi···there,→friend··°· |
| Many spaces to one | ·Hi·there,→friend·°· |
| Trim each line | Hi···there,→friend··° |
| Tabs to spaces | ··Hi···there,·friend··°· |
| Odd spaces to normal | ··Hi···there,→friend···· |
| All four | Hi·there,·friend |
Squeezing alone leaves a single space at each end and keeps the tab and the odd space. Only the full set gives clean text, which is why all four are on at the start.
How do I remove blank lines as well?
Under Empty lines, Keep all changes nothing. One in a row turns any stack of empty lines into a single gap between paragraphs, which is the usual choice for an email or an article. Remove all deletes every empty line, which suits a list that should have no gaps.
A line that holds only spaces counts as empty. With Trim each line on, such a line is emptied first and then handled by the empty-line choice. The example on this page has a stack of four empty lines. With One in a row, two of them are dropped and a single gap remains.
Line endings follow your input. Text with Windows line endings (two characters per break) stays that way, and so does text with the single-character kind. To strip repeated entries afterwards, use remove duplicate lines. To see how the length changed, a word counter shows words and characters.
When should I keep the spaces?
Leave Trim each line off when indentation matters, as in program code, a nested outline or a text table. Squeezing would flatten it. Switch off Many spaces to one as well if the text uses spaces to line columns up.
Nothing you paste is sent anywhere. The cleanup runs in your browser on your own device, and the result is plain text, so any formatting such as bold or links is not kept.
Use it with
- Remove Duplicate Lines: clean lists of repeated lines.
- Case Converter: UPPER, lower, Title, Sentence case.
- Word Counter: count words, characters, sentences.
Questions
How do I remove double spaces in text?
Paste the text and keep Many spaces to one ticked. Every run of two or more spaces becomes one space.
How do I remove spaces at the start and end of each line?
Keep Trim each line ticked. The edge spaces are removed and the count of removed edge spaces is shown.
Why do some spaces not go away?
They may be non-breaking or other special spaces, or tabs. Tick Odd spaces to normal and Tabs to spaces so they are treated like ordinary spaces first.
Does it delete blank lines?
Only if you ask. Choose One in a row to shrink stacks of blank lines to one, or Remove all to delete them.
Will it change my line breaks?
No. Line breaks stay where they are, except that empty lines can be dropped. To join lines, use the remove line breaks tool.
Is my text uploaded anywhere?
No. It is cleaned in your browser and never leaves your device.
How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.