Text cleaner: remove extra spaces, empty lines, invisible characters and HTML
Paste messy text, tick the clean-up options you want and copy the tidy result. It updates as you type.
- Free, no sign-up
- Your files and data stay on your device
- No watermarks or limits
0 bytes uploaded. Everything happens in this tab.
How to use it
- Paste your text into “Text to clean”.
- Tick the options you need. By default these are on: trim spaces at the start and end of each line, collapse repeated spaces, reduce several empty lines to one, remove invisible characters, replace non-breaking and special spaces, and remove empty lines at the end.
- Read the “Cleaned text”, then press “Copy result”, or “Use result as input” to run a second pass with different options.
Example
Defaults plus “Strip HTML tags”, “Replace curly quotes with straight quotes” and “Replace … with three dots”:
Before: “Smart” quotes… and odd spaces <p>Some <b>HTML</b> & more</p> After: "Smart" quotes... and odd spaces Some HTML & more
About this tool
Text copied from a web page, a PDF, a chat or a word processor often carries things you cannot see or did not mean to keep: double spaces, trailing spaces, long runs of blank lines, non-breaking spaces, curly quotes, zero-width characters and leftover HTML tags. They break search and replace, spoil a spreadsheet import, make two identical-looking lines fail a comparison and show up as odd symbols in code. This tool lets you remove exactly the kinds you choose, and shows how many characters changed.
There are twelve options: trim each line, collapse repeated spaces, reduce several empty lines to one, remove all empty lines, strip HTML tags, replace curly quotes with straight ones, replace en and em dashes with a hyphen, replace the ellipsis character with three dots, remove invisible characters, replace non-breaking and special spaces, replace tabs with 4 spaces and remove empty lines at the end. Line endings are always converted to a single line feed. Stripping HTML removes tags, comments and the content of script and style blocks, but it does not decode entities such as &.
A few cautions. The HTML option is a simple pattern match, not a parser and not a safety filter, so do not rely on it to sanitize untrusted markup. Removing invisible characters also removes the zero-width joiner and non-joiner and the direction marks, which some scripts and emoji sequences need; leave that option off for Arabic, Hebrew, Persian, Indic text or emoji, if those characters matter. Straightening quotes and dashes changes the typography of your text, so switch it off when you want to keep it. The number shown is the difference in length, so it is a guide rather than an exact count of edits. Your text stays on your device.
Frequently asked questions
What are invisible characters and why remove them?
They are characters such as the zero-width space, the soft hyphen and the byte order mark. They take no visible space but can break matching, sorting and comparisons, and often appear in text copied from the web.
Does it fix line breaks from a PDF?
It converts all line endings to one standard form and can remove or reduce empty lines. It does not join the lines of a wrapped paragraph.
Will “Strip HTML tags” make text safe?
No. It removes tags with a simple pattern, which is useful for pulling out readable text, but it is not a sanitizer for untrusted input.
Why does “Collapse repeated spaces” leave my indentation?
Spaces at the start of a line are kept unless you also tick the trimming option, so indented code and lists are not flattened by accident.
Is my text sent anywhere?
No. The cleaning runs in your browser and the text never leaves your device.