Skip to content

Text Cleaner

Strip invisible characters, stray spaces and smart quotes from text.

Runs entirely in your browser

The text is cleaned in this page and never leaves your device.

Text copied out of a web page, a PDF or a word processor arrives carrying passengers. Trailing spaces on every line, double spaces left over from a two-spaces-after-a-full-stop habit, curly quotes that a code editor will not accept, and characters that are genuinely invisible.

More about Text Cleaner

That last group causes the most confusing bugs. A zero-width space or a byte-order mark survives a copy and paste, shows nothing on screen, and then makes two identical-looking strings compare as different, or makes a CSV column refuse to parse. You cannot see them, so you cannot find them by looking, and the tool reports how many it removed so you know they were there.

Every operation is independent and off by default unless it is safe, so the tool never changes something you did not ask it to. The order they run in is fixed and it matters: invisible characters go first so they cannot hide inside a line that is about to be trimmed, and empty lines are removed last so that a line which becomes empty through trimming is caught too.

Line endings are left exactly as they were unless you ask for them to be normalised. A file that mixes Windows and Unix endings stays mixed, because silently rewriting all of them turns a one-line change into a diff where every line differs.

  • Trim each line, and collapse runs of spaces and tabs
  • Strip zero-width spaces, joiners and byte-order marks
  • Normalise line endings to LF, or leave them exactly as they were
  • Normalise Unicode to NFC so identical-looking text really is identical
  • Straighten curly quotes, long dashes and ellipses
  • Remove empty lines, including ones that become empty through trimming
  • Counts what each step actually changed

How to use it

  1. 1Paste the text you want to clean.
  2. 2Tick the operations you want; each one is independent.
  3. 3Read the result, with a count of what changed underneath.
  4. 4Copy or download the cleaned text.

Questions

What are invisible characters?

Zero-width spaces, joiners and byte-order marks: real characters that render as nothing. They survive a copy and then break string comparisons and CSV parsing.

What does normalising Unicode do?

It rewrites text to NFC, so a letter typed as a base plus a combining mark becomes the single precomposed character. Two identical-looking strings then really are identical.

Will my line endings be changed?

Only if you ask. Left alone, a mixed file stays mixed, because rewriting them all turns a small change into a diff where every line differs.

Why remove empty lines last?

So that a line containing only spaces, which becomes empty once it is trimmed, is removed too rather than surviving as a blank.

Is any of this destructive?

Only to the copy in the output panel. Your original text is untouched in the input, and nothing is saved anywhere.

More Text Tools
Esc

16 results