Text Tools · · 5 min read
How to Clean Messy Text Copied from Word, PDFs or the Web
Paste text into the Text Cleaner tool to strip HTML tags, straighten smart quotes, collapse extra spaces and remove invisible characters instantly.
To clean messy text, paste it into the Text Cleaner tool — it strips HTML tags, straightens curly quotes and dashes, collapses extra spaces, trims lines, caps blank lines at one, and removes invisible characters, all at once in your browser, with a running count of how many characters it removed.
What Text Cleaner does
Copy a paragraph out of Word, a PDF, an email, or a web page and it often brings baggage with it: leftover <p> and <span> tags, curly “smart” quotes and em dashes instead of plain ones, doubled-up spaces, a non-breaking space here or there, and zero-width characters you can't even see. Text Cleaner runs seven independent cleanups over pasted text and shows you the result immediately, so you can paste that text somewhere else — a CMS, a plain-text field, a script — without the hidden formatting causing problems.
How to clean text with Toolbench
- Open Text Cleaner.
- Paste your text into the Messy text box.
- The Clean panel on the right updates instantly with the result, and the header shows a status like "29 characters removed."
- Seven toggle buttons above the boxes control which cleanups run. All of them are on by default except Remove line breaks, which is off. Click any toggle to turn that cleanup off (or on).
- Click Copy to copy the cleaned text, or use Send to → to send it straight into another tool, like Text Diff or Word Counter.
The seven cleanups
| Toggle | Default | What it does |
|---|---|---|
| Strip HTML | On | Removes HTML tags and decodes entities (only runs if it detects a tag or entity in the text) |
| Straighten quotes & dashes | On | Converts curly quotes (“ ” ‘ ’) to straight ones, em/en dashes to -, … to ..., and non-breaking spaces to regular spaces |
| Collapse spaces | On | Turns runs of spaces or tabs into a single space |
| Trim lines | On | Trims leading/trailing whitespace from every line, and from the text as a whole |
| Max one blank line | On | Collapses three or more consecutive line breaks down to a single blank line |
| Remove line breaks | Off | Joins every line into one continuous block of text |
| Remove invisible chars | On | Strips zero-width spaces, zero-width joiners and soft hyphens that don't render but can break search and string matching |
Example: cleaning a pasted snippet
Here's text with the usual symptoms of a Word/web copy-paste — HTML tags, doubled non-breaking spaces, curly quotes, an em dash, an ellipsis, and uneven spacing:
Input:
<p>Hello “World”! This is a test.</p><p>Second paragraph — with an em dash…</p>
Output (default toggles):
Hello "World"! This is a test.
Second paragraph - with an em dash...
The status line reads "29 characters removed." Here's what happened: the <p> tags and entities were stripped, the curly quotes (“ ”) became straight ones, the em dash (—) became a hyphen, the ellipsis (…) became three periods, the runs of extra spaces collapsed to one each, and a line break was inserted where the paragraph tags used to be.
Turn on Remove line breaks on that same result and the two lines merge into one:
Hello "World"! This is a test. Second paragraph - with an em dash...
That's useful when you need the text to go into a single-line field that can't hold a paragraph break.
Tips and common mistakes
- Strip HTML only runs if it detects a tag or entity. If your pasted text has no
<...>markup and no&entity;codes, this toggle does nothing — plain text with curly quotes still gets straightened by the separate "Straighten quotes & dashes" toggle. - Turn off "Straighten quotes & dashes" if you're cleaning code or a shell command — flattening a smart quote inside a string literal is fine, but flattening an intentional em dash in a title you want to keep might not be.
- "Remove line breaks" is off by default because most cleanups (paragraphs copied from an article, a contract clause) should keep their paragraph structure. Turn it on only when you specifically need one unbroken line.
- Invisible characters are easy to miss but can break exact-match searches, URLs, and code. If find-and-replace or a script is silently failing to match text that looks right on screen, run it through Text Cleaner first — a stray zero-width space is a common culprit.
- The character count removed isn't just whitespace. It also reflects every HTML tag and decoded entity that disappeared, so a heavily tagged snippet can report a bigger number than you'd expect from just the visible spacing.
Related tools
- Text Diff — compare two versions of a text; clean both first so formatting differences don't show up as fake changes.
- Word Counter — check the word and character count of your text before or after cleaning it.
- Case Converter — normalize the casing of cleaned text to UPPER, lower, Title Case and more.
- Slug Generator — turn a cleaned title into a URL-safe slug.
Frequently asked questions
Is my text sent to a server when I use Text Cleaner?
No. The cleanup runs in your browser as you type or paste. If you're signed in, the text syncs privately to your account so it's there next time; if you're signed out, nothing is saved anywhere.
Why didn't Strip HTML remove anything from my text?
Strip HTML only runs when it detects an actual tag (like <p> or <span>) or an HTML entity (like ) in the pasted text. If neither is present, that cleanup is skipped — there's nothing for it to do.
What is the difference between Collapse spaces and Trim lines?
Collapse spaces turns multiple spaces or tabs within a line into a single space. Trim lines removes leading and trailing whitespace from each line (and from the whole block of text) — it doesn't touch spacing in the middle of a line.
Will cleaning my text change em dashes and curly quotes into something else?
Yes, if "Straighten quotes & dashes" is on (it is by default). Curly quotes become straight ones, em and en dashes become a plain hyphen, and ellipsis characters become three periods. Turn that toggle off if you want to keep the original typography.
Can I clean text and keep its paragraph breaks?
Yes — paragraph breaks are preserved by default. Only the "Remove line breaks" toggle collapses everything into one line, and it's off unless you turn it on yourself.
More guides
- How to Remove Duplicate Lines from a List (and Sort It Too)Paste any list into a free tool that trims, drops blank lines, removes duplicates, sorts A–Z or by length and numbers the result — nothing is uploaded.
- How to Compare Two Texts Online (Word or Line Diff)Paste two versions of a text into the Text Diff tool to see exactly what changed, word by word or line by line, with an added/removed count.
- How to Test a Regex Online (With Live Matches and Groups)Test JavaScript regular expressions live — highlighted matches, capture groups per match and a real-time replace preview, no install needed.