Remove whitespace from text

Delete spaces, tabs and line breaks from your text. Choose whether to remove all of it or only the spaces and tabs. The text is handled in your browser and nothing is uploaded.

What to remove

How it works

  1. Paste your text

    Type or paste the text in the left box, or open a .txt file. No text to hand? Click Example.

  2. Instant result

    The result appears as you type. Change the options and see straight away what changes.

  3. Copy or download

    Copy the result with one click, save it as a file or use it as input for a next step.

Three modes

Mode A sentence with spaces in the middle becomes
All whitespace Asentencewithspacesinthemiddle
Spaces and tabs, keep lines the same, with line breaks kept
Only the start and end of each line A sentence with spaces in the middle

The first two glue the words together; the last one only trims.

Typical uses

  • Cleaning phone numbers, IBANs and account numbers that were typed with spaces.
  • Getting the length of text without any spaces before you check a limit, for example with the character count without spaces.
  • Preparing keys and tokens that were wrapped across lines when copied.
  • Turning a block of text into one long line; for that without gluing words together, use remove line breaks.

Keep one space instead

If you want to keep a single space between words, use remove double spaces or normalize whitespace.

Frequently asked questions

What is the difference between the three modes?

*All whitespace* removes every space, tab and line break, leaving one long string. *Spaces and tabs, keep lines* removes those but keeps the line breaks. *Only the start and end of each line* trims the start and end of each line and keeps spaces inside.

How do I clean a phone number or IBAN?

Use *All whitespace*. `06 12 34 56 78` becomes `0612345678` and `NL91 ABNA 0417 1643 00` becomes `NL91ABNA0417164300`.

Is this the same as removing double spaces?

No. [Remove double spaces](/en/text/remove-double-spaces) leaves a single space between words. This tool deletes the spaces completely, so words run together.

What counts as whitespace?

Spaces, tabs, line breaks and other space characters such as the non-breaking space.