CruxDevCruxDev Tools Prompts
text Utility • Zero-Server Privacy • 100% Client-Side

Remove All Spaces

Strip every whitespace character from text — useful for formatting codes and identifiers.

Overview

Deletes every whitespace character from your text, including the invisible non-breaking spaces and tabs that a normal find-and-replace misses. The same panel offers six other clean-ups: trim the ends, collapse runs of spaces, strip blank lines, convert between tabs and spaces, and normalise line endings. It shows how many characters each operation removed.

How It Works

Paste your text into the Input text box. The page opens with Remove all selected, so the Cleaned panel immediately shows the text with every whitespace character gone, and Characters removed tells you how many were deleted. Pick a different operation to keep words separated: Collapse turns every run of whitespace into a single space, Trim only strips the start and end, and Strip blank lines removes empty lines but leaves the rest alone. Copy the cleaned output with its copy button.

Step-by-Step Usage Guide

  1. Paste the text into the Input text box.
  2. Keep Remove all for numbers, codes and encoded data; choose Collapse for normal sentences.
  3. Check Characters removed to confirm that hidden whitespace was actually there.
  4. Copy the cleaned text from the output panel.

Technical Specifications & Standards

Whitespace is a bigger category than the space bar. Text copied from web pages, Word documents and PDFs often carries non-breaking spaces (U+00A0), which look identical to a normal space but are a different character, so a search for a plain space skips them and a number like 1 000 refuses to parse. This tool uses JavaScript's whitespace class, which covers the normal space, tab, newline and carriage return, plus non-breaking spaces, the ideographic space used in Chinese and Japanese text (U+3000), the Unicode line and paragraph separators, and the byte-order mark (U+FEFF) that some editors put at the start of files. One character is deliberately not included: the zero-width space (U+200B). Unicode classifies it as a formatting character rather than whitespace, so it survives every mode here. If text still looks wrong after cleaning, paste it into the Unicode Inspector to find hidden characters like that one. Choosing the right mode matters. Remove all is right for things that must not contain any spacing, such as card numbers, IBANs, phone numbers, or base64 data that a mail client wrapped onto several lines. For prose it joins words together, so use Collapse there instead. The tab conversions use four spaces per tab, and Normalise line endings turns Windows CRLF and old Mac CR endings into Unix LF.

Targeted Use Cases

  • Cleaning card numbers, IBANs or phone numbers pasted with spaces before validating them.
  • Rejoining a base64 string or API key that an email client wrapped across several lines.
  • Removing non-breaking spaces that stop a pasted number from parsing in a spreadsheet.
  • Squashing the double spaces and stray tabs left over from a PDF copy into clean prose.

Notes & Gotchas

  • Use Collapse rather than Remove all for anything people will read, so words stay separated.
  • Check Characters removed: a non-zero count on text that looked clean means hidden whitespace was present.
  • Run the Unicode Inspector on text that still misbehaves, since zero-width spaces are not whitespace and are kept.
  • Normalise line endings before comparing files that came from different operating systems.

Frequently Asked Questions

Why do I still see gaps after removing spaces?

If the gaps remain, they are not whitespace characters. Zero-width spaces and some symbols look like gaps but are classified differently; paste the text into the Unicode Inspector to identify them.

Does it remove non-breaking spaces?

Yes. Non-breaking spaces (U+00A0), tabs, newlines, the ideographic space and the byte-order mark are all treated as whitespace and removed in Remove all mode.

How do I keep one space between words?

Choose Collapse. It trims both ends and replaces every run of whitespace, including line breaks, with a single normal space.

How many spaces does a tab become?

Four. Tabs to spaces replaces each tab with four spaces, and Spaces to tabs replaces each run of four spaces with one tab.