Embed this tool on your site
About this tool
Text copied from PDFs, web pages, Word documents, and email clients often arrives with unwanted baggage: double spaces, indented lines, piles of blank lines, curly smart quotes that break code, mixed Windows and Unix line endings, and stray HTML tags. Fixing these by hand is tedious and easy to miss. Text Cleaner applies the cleanups you tick in a single pass: collapse extra spaces and tabs and remove trailing spaces, reduce three or more line breaks to one blank line, remove leading tabs and spaces from each line, strip HTML tags, normalize smart punctuation (curly quotes to straight quotes, the ellipsis character to three periods, en dash to a hyphen, em dash to two hyphens), and convert CRLF or CR line endings to LF. The first three are on by default. Click Clean text to see the result, then copy it or reuse it as the next input. It does not join lines broken by PDF copy-paste or decode HTML entities. Your original stays in the editor, and everything runs in your browser.
Why use it
Configurable Per-Operation Toggles: Turn each cleaning step on or off individually so you never clean more than you intend.
Smart Quote Normalization: Replaces curly/typographic quotes with straight ASCII quotes — essential before pasting into code or JSON.
Blank Line Reduction: Collapses runs of three or more line breaks into a single blank line and trims the start and end of the text.
HTML Tag Stripping: Removes anything between angle brackets, such as <p> or <br>, when the Strip HTML tags option is on.
Excess Whitespace Removal: Collapses runs of spaces and tabs into a single space and removes trailing spaces at line ends.
Line Ending Normalization: Converts Windows CRLF and old Mac CR line endings to plain LF.
How to use
- Paste your messy or copied text into the Text to clean box.
- Tick the cleanups you need: Extra spaces, Repeated blank lines, Leading tabs and spaces, Strip HTML tags, Normalize smart punctuation, Normalize line endings.
- Click Clean text to apply the selected cleanups.
- Untick any option that changes text you want to keep, then click Clean text again.
- Click Copy result to copy the cleaned text to your clipboard.
- Click Use result as input to run another pass, or Clear to start over.
When it helps
- When text pasted from a PDF or web page has double spaces, indents and stacks of blank lines.
- When pasting content from Microsoft Word into a plain-text field that shows smart quote characters.
- When preparing text for import into a database or spreadsheet and leftover HTML tags need removing.
- When cleaning up scraped web content that contains excess whitespace and leftover markup.
- When normalizing text before running it through another tool like Word Counter or Find & Replace.
- When extracting email body text that has inconsistent line endings and double spacing.
Examples
01Collapse spaces and blank lines (default options)
InputHello world
This is messy.
Expected resultHello world
This is messy.
02Smart quote normalization
Input“Hello,” she said. ‘It’s fine.’
Expected result"Hello," she said. 'It's fine.'
Input<p>Tom & Jerry</p>
<p>Since 1940</p>
Expected resultTom & Jerry
Since 1940
Tips
- Tick Leading tabs and spaces when cleaning indented text copied from PDFs or emails so every line starts flush left.
- Disable smart quote normalization if your text contains foreign language dialogue where curly quotes are intentional.
- Run Text Cleaner before using Word Counter or Word Frequency Counter to ensure spacing artifacts do not inflate your word count.
- Run text full of HTML entities through Strip HTML Tags with Decode HTML entities ticked before cleaning it here.
- After cleaning, paste into the Text Diff tool to verify what exactly changed versus your original paste.
Frequently Asked Questions
What are smart quotes and why do they cause problems?⌄
Smart quotes are typographic quotation marks (“” ‘’) used in word processors for visual appeal. They are Unicode characters that differ from the ASCII straight quotes (" ') expected by JSON, code editors, and most programming languages — causing parse errors when pasted into those contexts.
Does it fix line breaks from PDF copy-paste?⌄
No. Text Cleaner does not join lines that a PDF broke mid-sentence. It removes repeated blank lines, indentation and extra spaces, but single line breaks inside a paragraph are kept.
Will it remove intentional line breaks in my text?⌄
Single line breaks are always kept. With Repeated blank lines on, three or more consecutive line breaks become one blank line, and whitespace at the very start and end of the text is trimmed.
Does it decode HTML entities?⌄
No. Entities such as & and are left exactly as typed. Use the Strip HTML Tags tool, which has a Decode HTML entities option, if you need them converted to characters.
Does it remove all whitespace or just excess whitespace?⌄
The Extra spaces option turns every run of spaces or tabs into a single space and removes trailing spaces from line ends. Single spaces between words are untouched.
Can it strip HTML tags as well?⌄
Yes. Tick Strip HTML tags to remove anything between < and >. It is a simple pattern match, so text like '<cartoon>' in plain prose is removed too, and entities are not decoded.
Does it handle Windows-style CRLF line endings?⌄
Yes, when Normalize line endings is ticked (it is off by default). CRLF (\r\n) and lone CR line endings are converted to LF (\n).
Is there any text that the cleaner might accidentally modify?⌄
With Normalize smart punctuation on, en dashes become hyphens, em dashes become two hyphens (--) and the ellipsis character becomes three periods. Strip HTML tags removes any text between < and > signs. Leave those options off if your text uses them intentionally.
Glossary
- Smart Quotes
- Typographic quotation marks (“” ‘’) that curve inward. They are Unicode characters distinct from straight ASCII quote characters used in code.
- HTML Entity
- A code sequence starting with & and ending with ; that represents a special character in HTML, such as & for & or for a non-breaking space.
- CRLF
- Carriage Return + Line Feed (\r\n), the Windows line ending convention. Unix systems use LF only (\n). Mixed line endings can cause display and parsing issues.
- Zero-Width Space
- A Unicode character (U+200B) that takes up no visible space but can cause unexpected behavior in text processing, search, and rendering.
- Non-Breaking Space
- A space character (U+00A0, HTML ) that prevents a line break at that position. Often copied from web pages and can cause word count inflation.
- Soft Hyphen
- A Unicode character (U+00AD) that suggests a hyphenation point but is invisible unless the word breaks across a line. Commonly left in text copied from typeset documents.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities