Clean up whitespace
Trim the edges of every line, collapse runs of spaces, drop empty lines and strip the invisible characters that break forms and code.
- Free, unlimited
- 100% on-device
- No sign-up
Clean up whitespace
Result
| # | Word | Count | Share | Bar |
|---|
Three steps — nothing to install
Paste the messy text
Copied from a web page, a PDF, Word, or a spreadsheet cell with a stray tab.
Tick the clean-ups
Each one is separate, so you can see what changed and leave indentation alone when you need to.
Copy the clean text
The result appears immediately. Nothing is uploaded and nothing is stored.
The invisible characters that cause trouble
A non-breaking space looks like a space and is not one. It arrives from web pages, from Word, and from PDFs, and it breaks searches, comparisons and CSV parsing. A zero-width space looks like nothing at all and silently splits words. A byte-order mark at the start of a copied string makes the first word fail to match.
The clean-up replaces all of those with ordinary spaces or removes them, along with tabs and the rarer Unicode spaces. If a form says a field is empty when you can see text in it, one of these characters is usually the reason.
What each option does, in order
The clean-up runs in a fixed order: invisible characters become spaces, tabs become two spaces, each line is trimmed, runs of spaces collapse to one, and finally empty lines are removed if you asked for that. Doing it in this order means trimming can remove the spaces that tabs and invisible characters produced.
Leave trim the edges of every line off when you are cleaning code or a table with meaningful indentation. Collapsing runs of spaces is also unsafe inside code. For prose, both are usually what you want; for markup, use the HTML minifier instead, which knows what to leave alone.
Where the stray spaces come from
Double spaces after a full stop are a typing habit that survived from the typewriter era. They are harmless in HTML, which collapses them anyway, and visible in plain text, Markdown source and SMS. Trailing spaces are worse: they are invisible, they break line-based comparisons, and some version control systems flag them as errors.
Copying from Word brings its own set: curly quotes, non-breaking spaces and sometimes a trailing paragraph mark. If you are moving text into a database or a form, clean it here first and check the result in the word counter before submitting.