Remove extra spaces

Clean up text with double spaces, stray indents and long gaps of blank lines. Choose what to fix, copy the result and see how many characters were removed.

Removed characters: 17

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste the text into the left box. The cleaned version appears on the right.
  2. Pick what to fix: repeated spaces, spaces at the ends of lines, and what to do with blank lines.
  3. Check the count under the result, then press Copy.

How it works

The text is split into lines. On every line, each run of spaces, tabs and other horizontal whitespace is replaced with one space, and the spaces at both ends are cut off. Then blank lines (empty, or only whitespace) are kept, reduced to one in a row, or removed. The count is the difference between the lengths of the input and the output in characters.

Worked example

“ one two “, a blank line, another blank line and “three” with the default settings become “one two”, one blank line and “three”. The leading and trailing spaces are trimmed, the three spaces become one, and the two blank lines become one.

Tips

Spaces inside a line that you want to keep, such as aligned columns or code, are lost when you collapse them, so turn that option off for tables made with spaces. Indentation in code is removed too when you trim lines.

Frequently asked questions

What counts as a space here?

Spaces, tabs and other horizontal whitespace such as the non-breaking space. Each run of them becomes a single normal space. Line breaks are not spaces; they are handled by the blank-lines setting.

Does it change the line breaks?

Only blank lines are affected. Lines that contain text keep their line breaks, and Windows line breaks (CR + LF) are written back as plain line feeds. To join lines into paragraphs, use the remove line breaks tool.

What is a blank line?

A line that is empty or holds only whitespace. "Keep at most one in a row" turns any group of them into one empty line, which keeps paragraphs apart without big gaps.

Does it remove spaces between words completely?

No. Between words one space always stays. If you need to delete all spaces, use find and replace and replace a space with nothing.

More in Text

All tools in this category: Text ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.