Skip to content

Remove Spaces

What to remove
Cleaned text —
Characters removed
—
Space characters found
—
Length before
—
Length after
—

Paste your text and pick a mode. Extra spaces turns each run of spaces into one and trims every line, so ' Hello world ' becomes 'Hello world' with 6 characters removed. All spaces deletes every space and tab, and the third mode also joins the lines.

About this tool

Text copied from PDFs, spreadsheets and web pages often carries double spaces, tab characters and invisible no-break spaces that break searches, form fields and data imports. This cleaner fixes that in three ways: it can tidy spacing while keeping words apart, delete every space so a phone number, IBAN or serial code fits a field that rejects gaps, or remove line breaks too so a wrapped code becomes one string. Alongside the cleaned text it reports how many space characters it found and how many characters were removed, so you can confirm nothing else changed. One limit: it only touches spacing, so stray punctuation or zero-width joiners inside emoji are left as they are.

How to use it

  1. Add the text

    Paste into the box or open a .txt or .csv file from your device.

  2. Choose what to remove

    Pick Extra spaces, All spaces, or Spaces and line breaks.

  3. Check the counts

    Compare the length before and after with the number of characters removed.

  4. Copy the result

    Use Copy result to take the cleaned text back into your document or form.

Examples

Double spaces and padding

Text to clean
Hello world
What to remove
Extra spaces

Result Cleaned text: Hello world
Characters removed: 6
Space characters found: 7
Length before: 17
Length after: 11

  1. Found 7 space characters in 17 characters.
  2. Turned each run of spaces or tabs into one space and trimmed both ends of every line.
  3. 17 − 11 = 6 characters removed.

Leading and trailing spaces are trimmed and the triple gap becomes a single space.

A phone number for a form

Text to clean
+44 20 7946 0958
What to remove
All spaces

Result Cleaned text: +442079460958
Characters removed: 3
Space characters found: 3
Length before: 16
Length after: 13

  1. Found 3 space characters in 16 characters.
  2. Deleted every space, tab and no-break space; line breaks were kept.
  3. 16 − 13 = 3 characters removed.

Forms that reject spaces accept the digits once the three gaps are deleted.

A code split over two lines

Text to clean
AB12 CD 34
What to remove
Spaces and line breaks

Result Cleaned text: AB12CD34
Characters removed: 2
Space characters found: 1
Length before: 10
Length after: 8

  1. Found 1 space characters in 10 characters.
  2. Deleted every space, tab and line break, joining the text into one run.
  3. 10 − 8 = 2 characters removed.

The line break and the space both go, leaving one eight-character string.

How it is calculated

removed = length before − length after

space characters
ASCII space, tab, no-break space (U+00A0), the Unicode spaces U+2000 to U+200B, U+202F, U+205F, U+3000 and the byte-order mark
length
count of Unicode code points, so an accented letter or a simple emoji counts once

In Extra spaces mode each line is processed separately: every space character becomes a plain space, runs of two or more collapse to one, and the ends are trimmed. All spaces deletes every space character but keeps line breaks. Spaces and line breaks also deletes carriage returns, line feeds and Unicode line separators.

When not to use it

  • For code or Markdown where indentation carries meaning, since trimming lines destroys it.
  • For CSV files with quoted fields that contain deliberate spaces, which a spreadsheet's own trim function handles per column.

Common mistakes

  • Choosing All spaces for prose, which glues every word together.
  • Assuming a pasted gap is a normal space when it is a no-break space that a basic find-and-replace misses.

Frequently asked questions

Does it remove non-breaking spaces?

Yes. The no-break space U+00A0, common in text copied from web pages and Word, is treated like a normal space, as are thin, figure and ideographic spaces.

Will my line breaks be kept?

In Extra spaces and All spaces modes, yes: every line stays on its own line. Only the Spaces and line breaks mode joins the lines into one string.

Why is the removed count higher than the spaces found?

In the line-break mode the removed count also includes the newline characters. In Extra spaces mode it is lower, because one space is kept between words.

Can I clean a phone number or IBAN for a form?

Yes. Choose All spaces and '+44 20 7946 0958' becomes '+442079460958'. Banks print IBANs in groups of four, and many forms want them without gaps.

Are tabs treated as spaces?

Yes. A tab is a space character here, so in Extra spaces mode a tab between words becomes a single space, and in the other modes it is deleted.

Is my text uploaded?

No. The cleaning runs in your browser, and an opened file is read locally on your device rather than sent to a server.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, October 19). Remove Spaces. Tools Directory. Retrieved October 26, 2026, from https://tools.milunir.com/text-tools/cleanup-sorting-and-lists/remove-spaces/

MLA

Tools Directory Editorial Team. “Remove Spaces.” Tools Directory, 19 Oct. 2026, https://tools.milunir.com/text-tools/cleanup-sorting-and-lists/remove-spaces/. Accessed 26 Oct. 2026.

Chicago

Tools Directory Editorial Team. “Remove Spaces.” Tools Directory. Last modified October 19, 2026. Accessed October 26, 2026. https://tools.milunir.com/text-tools/cleanup-sorting-and-lists/remove-spaces/.

Link<a href="https://tools.milunir.com/text-tools/cleanup-sorting-and-lists/remove-spaces/">Remove Spaces – Tools Directory</a>