About Text Cleaner
Text Cleaner normalises the small inconsistencies that creep into copy-pasted text and break downstream tools: double spaces, tabs vs spaces, mixed line endings (CRLF vs LF), Microsoft-Word smart quotes, em-dashes, zero-width characters, and other invisible code points. Toggle the cleanups you want and the preview updates as you type. Especially useful before pasting text into a database, a code editor, an SEO field, or anywhere stray non-breaking spaces and curly quotes will silently corrupt your data.
- No uploads
- Browser-only
- Works offline
- 100% free
How it works
- 1
Paste messy text
Drop in whatever needs cleaning — a Word doc paragraph, an email, a markdown chunk, a CSV row.
- 2
Pick which fixes to apply
Toggle: collapse multiple spaces, trim trailing whitespace, normalise line endings to LF or CRLF, straighten smart quotes, unify dashes, strip zero-width characters, remove non-printable invisibles.
- 3
Copy the cleaned output
The preview panel reflects every toggle live. Copy to clipboard or download. A small badge shows how many characters were changed or removed.
What "clean text" actually means
Text that looks fine on screen is often dirty underneath. Copying a paragraph out of a PDF, a Word document, a Slack message or a webpage drags along baggage you can't see: non-breaking spaces (U+00A0) masquerading as ordinary spaces, curly "smart" quotes that break code and CSV files, trailing whitespace at the end of every line, and a scattering of zero-width characters that pad the string with invisible bytes. Cleaning normalizes all of that back to plain, predictable text — the kind that diffs cleanly, pastes into a terminal without surprises, and counts the way you expect.
The fixes fall into four buckets, and which ones matter depends entirely on where the text is headed. Whitespace and line endings matter for code and data. Smart-quote and dash normalization matters for anything that touches a compiler, a shell, or a regular expression. Invisible-character stripping matters for security review and for text you suspect was copied from a rich source. Knowing which problem you actually have saves you from over-cleaning.
The four problems, and when each one bites
| Problem | What it is | When it actually causes trouble |
|---|---|---|
| Whitespace noise | Trailing spaces, runs of spaces, blank-line pile-ups, tabs vs spaces | Diffs show phantom changes; YAML/Python indentation breaks; Markdown swallows line breaks |
| Line endings | Windows CRLF vs Unix LF vs old Mac CR | Git warns on every commit; shell scripts fail with \r errors; CSV imports gain blank rows |
| Smart punctuation | Curly quotes, en/em dashes, ellipsis | Code won't compile; CSV fields split wrong; regex literals stop matching |
| Invisible characters | Zero-width space (U+200B), zero-width joiner, BOM (U+FEFF), non-breaking space | String length is "wrong"; equality checks fail; passwords and tokens silently mismatch |
Most pasted-from-rich-source text carries at least two of these at once.
Why zero-width characters are worth taking seriously
Zero-width and invisible characters render as nothing, but they are real codepoints that occupy bytes and change how a string compares. A zero-width space (U+200B) wedged into a coupon code, a username, or an API key makes two visually identical strings unequal — and the bug is nearly impossible to spot by eye. The Unicode Standard defines these as default-ignorable formatting characters; see the character database at unicode.org. A byte-order mark (U+FEFF) at the very start of a file is the classic offender: it's invisible, but it breaks JSON parsers, prepends junk to the first CSV header, and shows up as a stray glyph in some editors.
Stripping them is also a mild security hygiene step. Invisible characters have been used to hide watermarks in shared text and, in some attacks, to smuggle confusable content. If you've pasted text from an unknown source and something downstream is behaving oddly, running it through a clean pass that removes zero-width codepoints is a fast first diagnosis.
What cleaning is not — and how to avoid over-cleaning
- It is not encoding conversion. Cleaning normalizes characters; it does not transcode UTF-16 to UTF-8 or fix mojibake. Garbled-encoding damage happens before the text reaches you and a clean pass won't reverse it.
- Don't collapse whitespace blindly inside code. Leading indentation in Python or YAML is load-bearing — flatten it and you change the program. Clean line endings and trailing spaces there, but leave indentation alone.
- Smart-quote removal is one-directional and lossy by design: you're choosing straight quotes on purpose. If you're publishing prose for humans, you may actually want the curly quotes — keep them for the web, strip them for code and data.
- If you only need to change letter casing or count what's left, that's a different job — reach for Text Case or Word Count instead of cleaning.
- To confirm a clean pass changed exactly what you intended and nothing else, paste before-and-after into Text Diff and read the delta.
Frequently asked questions about Text Cleaner
Why are 'invisible characters' a problem?
Code points like U+200B (zero-width space), U+FEFF (BOM), U+00A0 (non-breaking space), and various RTL marks render as nothing but break things downstream: query parameters that don't match, SQL LIKE clauses that miss rows, password fields that reject 'correct' passwords. Cleaning them up costs nothing and prevents hours of head-scratching.
Will it touch text inside code blocks or quoted strings?
It treats input as a single plain-text blob — no markdown or syntax awareness. If you're cleaning a markdown document that contains code samples, paste those sections through separately, or use the Markdown Preview tool to verify nothing important changed before saving.
Does it convert smart quotes back to straight quotes?
Yes, when the 'straighten quotes' option is on. Curly double quotes become straight double quotes; curly single quotes become straight single quotes. Useful for CSV, code, SQL, or anywhere a smart quote would cause a parse error.
Privacy, offline use, browser support, and pricing questions are answered on the site-wide FAQ.