Remove Extra Spaces

Fix text with doubled spaces, stray tabs and invisible spaces at the ends of lines. Paste it here and the tool replaces each run of spaces or tabs with a single space, trims every line, and can squeeze long gaps of blank lines down to one. Line breaks and paragraphs stay in place. Copy or download the cleaned text; it never leaves your browser.

Inputs

Result

Cleaned text
Plain text often picks up extra spaces.
Tabs and double spaces sneak in when you paste.

Trailing spaces hide at line ends.
Characters before
139
Characters after
120
Characters removed
19

How it is calculated

  1. Cleaned text: start from the text, then convert Windows and old Mac line endings to standard line breaks, then replace each run of spaces or tabs inside a line with one space, then remove spaces and tabs at the start and end of each line, then keep at most one empty line in a row
  2. Characters before: start from the text, then convert Windows and old Mac line endings to standard line breaks, then count characters as you see them, including spaces
  3. Characters after: start from the cleaned text, then count characters as you see them, including spaces
  4. Characters removed = characters before − characters after

Resources for your next step

Helpful downloads

View all text & lists downloads
Store coming soon

We are preparing practical spreadsheets, planners, and guides. Explore the store page for what is next.

What the cleanup does

Three steps run in order. First, every run of two or more spaces, and every tab, becomes one ordinary space. Second, spaces at the start and end of each line are removed. Third, if the option is on, three or more line breaks in a row become two, which leaves exactly one empty line between paragraphs.

The example has three lines of text with extra spaces and tabs, separated by a gap of three blank lines, and trailing spaces at the end. After cleanup each line has single spaces, the gap becomes one empty line, and the character count drops from 139 to 120, so 19 extra characters were removed.

Which characters count as spaces

Besides the regular space, the tool treats tabs, the non-breaking space often pasted from web pages and word processors, and the other fixed-width spaces defined as white space in the Unicode Character Database as spaces. Each run of them becomes a single regular space. Line breaks are not touched by this step, so your lines stay separate.

Zero-width characters, which take up no visible room, are not removed, because they can carry meaning in some languages and emoji sequences. Characters are counted as they appear on screen, so an accented letter or an emoji with a skin tone counts as one character, and line breaks are not counted.

Paragraphs and blank lines

With the blank line option on, long gaps between paragraphs shrink to a single empty line, which is how most writing is laid out. Turn it off to keep blank lines exactly as they are, for example when spacing carries meaning in a poem or a template. To remove blank lines completely, use the remove empty lines tool.

Indentation at the start of a line is removed as part of trimming. If you need to keep indentation, such as in code or nested lists, this tool is not the right fit; tidy only the parts that need it.

When to use it

Extra spaces sneak in when text is copied from PDFs, emails, spreadsheets and web pages, or when it was typed with two spaces after each sentence. Cleaning them up before you paste into a document, a form or a database keeps formatting consistent and avoids matching problems in searches and lookups.

The counts show how many characters were removed, which helps when a field has a character limit. Up to 200,000 characters can be cleaned at once, and the text is processed on your device only.

Frequently asked questions

Does it remove line breaks?

No. Lines stay separate. Only runs of empty lines can be shortened, and only when the option is on.

Does it remove tabs?

Yes. Each tab, or run of tabs and spaces, becomes a single space.

What about non-breaking spaces from web pages?

They are treated as spaces, so runs of them are replaced with one regular space and they are trimmed from line ends.

Will it remove indentation?

Yes. Spaces at the start of each line are trimmed, so indented code or nested lists lose their indentation.

How are characters counted?

As they appear on screen: an accented letter or emoji counts once, spaces count, and line breaks do not.

Is my text private?

Yes. The cleanup runs in your browser and nothing is uploaded or stored.

Sources

Text is processed in your browser and never sent anywhere. Check the result before you replace your original.

All text & lists tools