RevealTheme logo

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. 1

    Paste your messy text into the input box.

  2. 2

    Toggle the options you want: trim lines, collapse spaces, remove line breaks, replace tabs, and fix smart quotes.

  3. 3

    Read the cleaned result in the lower box, which updates live as you type or change options.

  4. 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?
Curly quotes and apostrophes break code syntax, can corrupt CSV parsing, and render inconsistently in plain-text contexts. In prose they read fine, but for source code, config files, and data exports you usually want straight ASCII quotes.
Does it preserve em-dashes?
No. The smart-quote option deliberately replaces both en-dashes and em-dashes with a single hyphen. This is typographically lossy, so if you care about keeping em-dashes in published prose, leave the 'fix smart quotes' toggle off.
Does it remove non-breaking spaces?
No. The collapse rule only matches the regular ASCII space (U+0020). A non-breaking space (U+00A0) - the most common artifact when pasting from Word or a web page - is a different character and passes through unchanged, as do zero-width characters. For those, use a dedicated Unicode-aware tool or your editor's normalize feature.
What does the 'replace tabs' option do?
It converts each tab character to one space. Because it runs before the collapse step, a run of tabs first becomes a run of spaces and then collapses to a single space when 'collapse spaces' is also on.
Does 'remove line breaks' delete blank lines or join paragraphs?
It joins everything onto one line by replacing every run of newlines with a single space, so all paragraph structure is lost. It is off by default for that reason. Leave it off if you want to keep your lines separate.
Is my text uploaded anywhere?
No. All cleaning happens locally in your browser with JavaScript string replacements, and the copy button uses your browser's clipboard. Nothing you paste is sent to a server.
Why is some text still messy after cleaning?
The rules cover a deliberately small set of characters: ASCII spaces, tabs, newlines, curly quotes, ellipsis, and dashes. Anything outside that set - non-breaking spaces, soft hyphens, zero-width joiners, or other Unicode oddities - is left as-is. For those edge cases, run the text through a full Unicode normalizer.

Related tools