How to remove whitespace
- Paste the text with messy spacing into the box above.
- Choose a mode. Extra spaces handles the common case and is the default.
- Use Leading or Trailing when only one end of each line needs fixing.
- Use All whitespace only when you genuinely want one unbroken string.
- Check the character count reported, then copy or download the result.
What each mode does
- Extra spaces: tabs become spaces, runs collapse to one, trailing spaces go, blank runs shrink.
- Leading: removes indentation from the start of every line.
- Trailing: removes the invisible spaces at the end of every line.
- Blank lines: drops empty lines while leaving the rest untouched.
- All whitespace: removes every space, tab and line break in the text.
- A report of exactly how many whitespace characters were removed.
Whitespace you can see, and whitespace you cannot
Extra spacing arrives from everywhere. Text pasted from a PDF carries indentation that belonged to the page layout. Spreadsheet exports pad values with trailing spaces. Word processors leave double spaces after full stops, a habit inherited from typewriters. Copy-and-paste from a website brings the source's own formatting with it.
The trailing kind causes the most trouble precisely because it is invisible. A cell containing "London " does not match "London" in a lookup. An email address with a trailing space fails validation for no visible reason. A password field with a stray space rejects a password that looks correct. Removing it fixes a whole class of bugs that are otherwise maddening to diagnose.
Choosing the right mode
- Extra spaces: the everyday choice. Fixes double spaces, converts tabs, trims line ends and collapses excessive blank lines, all without changing structure.
- Leading: flattening indented text, such as a quoted email or code pasted with its surrounding indentation.
- Trailing: cleaning data before import, where trailing spaces break matching.
- Blank lines: closing up double-spaced text while keeping every real line.
- All whitespace: building a single unbroken string, checking a palindrome, or preparing a value that must contain no spaces at all.
Be careful with all-whitespace mode
It does exactly what it says: every space, tab and line break disappears, and "the quick brown fox" becomes "thequickbrownfox". There is no way to reconstruct the original from the result, because the information about where the spaces were is simply gone.
That makes it genuinely useful for a narrow set of jobs, palindrome checks, hash inputs, comparing two strings while ignoring formatting, and destructive for anything you intend to read. Keep your original text if there is any chance you will want it back.
Tabs, and why they get converted
Extra-spaces mode turns tabs into single spaces. That is right for prose and wrong for anything where tabs are structural, indented source code, or a TSV file where the tab is the field delimiter. Converting those tabs will break the format.
For code and delimited data, use leading or trailing mode instead, which leave interior tabs alone. It is worth checking what your text actually contains before running the default over it.
One space or two after a full stop?
The double space is a typewriter convention. Typewriters used monospaced type where every character occupied the same width, and two spaces helped mark sentence boundaries. Proportional typefaces, which everything uses now, space full stops correctly on their own, and every modern style guide specifies one space.
Extra-spaces mode collapses them automatically. If your text also needs its line breaks reflowing, run it through the line break remover afterwards, and the text cleaner handles the invisible characters this tool does not touch. Everything runs locally with no upload.