Whitespace Remover
Remove all whitespace, or just the leading and trailing kind, with a visualiser that shows what is actually there.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Whitespace Remover does
This whitespace remover will remove all whitespace, or just the leading and trailing kind, with a visualiser that shows what is actually there. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for diagnosing mixed tabs and spaces in a code file. People using this often want the duplicate line finder next.
How to use it
- Paste the text.
- Pick what to remove, or choose the visualiser to see what is actually in there.
- For tab conversion, set how many spaces each tab becomes.
- Copy the result.
How it works
The visualiser mode is the useful one when something is wrong and you cannot see why. It renders a space as ·, a tab as an arrow, a carriage return as ⏎ and a line end as ¶, which makes mixed tabs and spaces, stray trailing whitespace and Windows line endings all immediately visible.
Mixed indentation is the classic case. A file indented with tabs in some places and four spaces in others looks consistent in one editor and ragged in another, and in Python it is a syntax error. Seeing the actual characters is the only reliable way to diagnose it.
Non-breaking spaces are the other common culprit. Text pasted from a word processor or a web page often contains U+00A0 where an ordinary space should be, which looks identical and behaves differently — it does not collapse in HTML and does not match a /\s/ pattern in some older regex implementations.
When to use it
- Diagnosing mixed tabs and spaces in a code file.
- Trimming trailing whitespace from every line.
- Removing all spaces to produce a compact string.
- Finding a stray non-breaking space that is breaking a layout.
Common mistakes to avoid
- Removing all whitespace from prose, which makes it unreadable.
- Converting tabs to spaces in a file where tabs are required, such as a Makefile.
- Assuming a space is a space. Non-breaking and other Unicode spaces look identical and behave differently.
Frequently asked questions
How do I remove all spaces from text?
Pick "All whitespace everywhere". That strips spaces, tabs and line breaks, leaving a single continuous string.
How can I see tabs and spaces?
Choose the visualiser mode. Spaces render as ·, tabs as arrows, and line ends as ¶, which makes mixed indentation obvious.
What is a non-breaking space?
U+00A0, a space that does not collapse or allow a line break. It looks identical to an ordinary space and is a frequent cause of layout and matching bugs.