Text Cleaner
Collapse runs of spaces, trim line whitespace, convert tabs to spaces, and replace common typographic characters in pasted text. Everything runs in your browser with a few toggles.
How to use this tool
- 1
Paste your messy text into the input box.
- 2
Toggle the options you want: trim lines, collapse spaces, remove line breaks, replace tabs, and fix smart quotes.
- 3
Read the cleaned result in the lower box, which updates live as you type or change options.
- 4
Click 'Copy clean text' to copy the result to your clipboard.
What does this text cleaner actually change?
Text copied from PDFs, websites, and word processors carries invisible formatting artifacts that this tool rewrites with simple find-and-replace rules. With the default toggles on it does four things: it converts each tab character to a single space, collapses any run of two or more ASCII spaces down to one, trims leading and trailing whitespace from every line (and the whole string), and replaces a small set of typographic characters with ASCII equivalents. The smart-quote rule maps curly single quotes to a straight apostrophe, curly double quotes to a straight double quote, a horizontal ellipsis to three periods, and both en-dashes and em-dashes to a single hyphen. An optional 'remove line breaks' toggle (off by default) joins every line into one by turning newline runs into a space. The rules are intentionally minimal and operate on specific characters, so they are fast and predictable but not exhaustive. Notably, a non-breaking space (the most common artifact in Word and web paste) is not an ASCII space and passes through untouched, and zero-width characters are left in place. For full Unicode normalization, reach for a dedicated library or your editor's normalize command.
Common use cases
Cleaning a quote pasted from a Word document before dropping it into source code, where curly apostrophes would cause syntax errors.
Flattening multi-line text copied from a PDF into a single line for a spreadsheet cell or search field using the remove-line-breaks toggle.
Removing the trailing spaces and tab-indented lines that sneak in when copying from a chat app or rendered web page.
Normalizing en-dashes and em-dashes to plain hyphens so a CSV or plain-text export stays ASCII-safe.
Tidying marketing copy pasted into a CMS field so double spaces after sentences collapse to single spaces.
Preparing a code comment or commit message by stripping the smart quotes and ellipses an editor auto-inserted.
Frequently asked questions
Why replace smart quotes with straight ones?▼
Does it preserve em-dashes?▼
Does it remove non-breaking spaces?▼
What does the 'replace tabs' option do?▼
Does 'remove line breaks' delete blank lines or join paragraphs?▼
Is my text uploaded anywhere?▼
Why is some text still messy after cleaning?▼
Related tools
Word & Character Counter
Count words, characters, sentences, paragraphs.
Reading Time Calculator
Estimate reading time for any text.
Headline Analyzer
Score headlines for engagement and SEO.
Email Subject Line Tester
Score email subject lines for open rate.
Markdown to HTML
Convert Markdown to HTML.
HTML to Markdown
Convert HTML to clean Markdown.