Remove Extra Spaces is a free online tool that turns double spaces into one, trims spaces at the start and end of each line and replaces tabs with a space, for up to 500,000 characters. You can also delete empty lines and see how many characters were removed, with no sign-up.
How to remove extra spaces
- Paste your text. Paste the text in the Text to clean box.
- Choose what to clean. Three options are on from the start: double spaces, spaces at line ends, and tabs. Tick Remove empty lines if you also want that.
- Copy the result. The clean text appears in the Clean text box. Press Copy to use it.
What are extra spaces?
To remove extra spaces is to delete the spaces a text does not need: two or more spaces between words, spaces at the start or end of a line, and tabs used as gaps. Extra spaces often come from text copied out of a PDF, a table or a web page.
They are hard to see but they cause problems, for example in a list that will be sorted, compared or pasted into a form.
Remove spaces: what goes and what stays
The tool removes spaces that do nothing and keeps the ones that separate words. For example, red, green and blue with three and four spaces between them and two spaces at each end become red green blue, and the counter shows 9 characters removed.
- One space between words stays, so the text remains readable.
- Line breaks stay where they are. Tick Remove empty lines to delete blank lines.
- Tabs become spaces and merge with the spaces next to them, so a tab between two words leaves one space.
- Special spaces stay, such as the no-break space from a web page, because the tool cleans normal spaces and tabs.
Features
- Double spaces to single spaces across the whole text.
- Trim the start and end of every line.
- Tabs replaced with a space.
- Empty lines removed when you ask for it.
- Count of the characters removed, and Copy, Select or Download for the result.
The options
| Option | What it does | On at the start |
|---|---|---|
| Turn two or more spaces into one | Every run of spaces becomes a single space | Yes |
| Remove spaces at the start and end of each line | Lines begin and end with a character, not a space | Yes |
| Replace tabs with a space | Each tab becomes one space, which is then merged with spaces next to it | Yes |
| Remove empty lines | Lines with no text are deleted | No |
Line breaks are kept. To join the lines, use the Remove Line Breaks tool, which is linked under Related tools below.
Is it private?
Yes. The text is cleaned inside your browser. It is not sent to our server and is not saved by us.
Tips to remove extra spaces
- Keep indentation by turning two options off. Indentation in code and tables is made of spaces at the start of lines. Untick the trim option and the option that turns two or more spaces into one, and untick Replace tabs if the indentation uses tabs.
- Fix a gap that stays by hand. A gap left after cleaning is made of a special space, such as a no-break space from a web page. Delete it or type a normal space in its place.
- Tick Remove empty lines for lists. It is off from the start, so blank lines stay until you ask the tool to delete them.
- Join lines with Remove Line Breaks. This tool keeps every line break, so use Remove Line Breaks when the text should become one paragraph.
- Paste up to 500,000 characters at a time. Clean a longer text in parts.
Related tools
Three other tools on this site clean text. The tool to remove line breaks joins broken lines into paragraphs. The find and replace tool changes or deletes any text you choose. The tool to remove duplicate lines deletes repeated lines.
Frequently asked questions
- How do I remove double spaces from text?
- Paste the text in the box. Every run of two or more spaces becomes one space.
- Does it remove spaces at the end of lines?
- Yes. Spaces at the start and at the end of each line are removed. You can turn this off.
- Does it remove line breaks too?
- No. Line breaks are kept. It can remove empty lines if you tick that option.
- Does it remove all spaces?
- No. One space stays between words, so the text remains readable.
- Is the Remove Extra Spaces tool free?
- Yes. It is free and you do not need an account.