Remove extra spaces
Clean up messy text in one step: collapse double spaces, turn tabs into spaces, trim line ends and cut down blank lines. Free, and your text never leaves your browser.
How to use it
- Paste your text in Your text.
- Keep the cleanup options you want ticked, such as Collapse repeated spaces into one.
- Pick what to do with empty lines in Blank lines, or tick Join everything into a single line.
- Copy the result from Clean text.
Complete guide to removing extra spaces and blank lines
Why extra spaces appear
Text rarely arrives clean. Copying from a PDF adds double spaces and broken lines, pasting from a web page brings non-breaking spaces you cannot see, spreadsheets add tabs, and people who type two spaces after a period leave gaps that look uneven in a layout. These spaces cause real problems: form fields reject entries with trailing spaces, a search for a name misses the entry that has two spaces inside it, and word processors justify lines badly. This tool cleans all of that in one pass without touching a single letter, number or punctuation mark.
What each option does
| Option | Effect |
|---|---|
| Collapse repeated spaces into one | Two or more spaces in a row become one. Special spaces, such as the non-breaking space and the wide typographic spaces, are first turned into normal spaces |
| Turn tabs into spaces | Each tab becomes one space, which is then collapsed if the option above is on |
| Trim spaces at the start and end of each line | Removes indentation and trailing spaces on every line |
| Trim blank space around the whole text | Removes spaces and empty lines before the first word and after the last |
| Blank lines | Keep as they are, allow at most one in a row, or remove all |
| Join everything into a single line | Merges all non-empty lines into one line separated by single spaces |
Worked example
Take the text Hello world , then three empty lines, then next followed by a tab and line . It has 34 characters. With the default settings (everything ticked and Blank lines on Allow at most one in a row) the result in Clean text is two lines separated by one blank line: Hello world and next line. The summary shows 34 characters before, 22 after and 12 removed.
- Change Blank lines to Remove all blank lines. The two lines now touch each other with no gap: 21 characters after, 13 removed.
- Tick Join everything into a single line. You get
Hello world next line, 21 characters, useful for pasting a wrapped paragraph into a single-line field.
Tips and common mistakes
- If you untick Collapse repeated spaces into one, double spaces inside a line stay. Use that setting only when the spacing is deliberate, for example aligned columns.
- Removing blank lines also removes the visual separation between paragraphs. For prose, prefer Allow at most one in a row so paragraphs stay separated by a single empty line.
- Joining into one line loses all line breaks, including the ones between list items or poem lines. It cannot be undone, so keep your original text.
- Only spaces, tabs and empty lines change. If a gap remains, it may be a different character, such as a line break or a dash, which this tool leaves alone.
Related tools
After cleaning you can check the result with the word and character counter. To delete repeated entries in a list, use the duplicate line remover, and to replace specific characters in bulk, use find and replace.
Questions
What counts as an extra space?
Two or more spaces in a row, spaces at the start or end of a line, and special spaces such as the non-breaking space, which are turned into normal spaces.
Does it change my line breaks?
Only if you ask. By default single line breaks stay, and runs of blank lines are cut to one. You can keep them as they are, remove them all or join the text into one line.
Does it touch the words themselves?
No. Only spaces, tabs and empty lines are changed. Letters, numbers and punctuation stay exactly as you typed them.
Is my text uploaded anywhere?
No. The cleanup runs in your browser and nothing is sent or stored.