Text Cleaner
Multi-mode text normalization — whitespace, HTML, smart quotes, zero-width characters, and more.
Options
Characters: 0Lines: 0
Text Cleaner
Text Cleaner applies a configurable sequence of normalization passes to your input. Whitespace normalization collapses multiple consecutive spaces and tabs into a single space. HTML stripping removes any tag enclosed in angle brackets. Smart-quote straightening converts Unicode left/right quotation marks back to their ASCII equivalents — useful before pasting text into code or JSON. Zero-width character removal catches invisible formatting characters that can break parsers. All transformations run locally in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Normalising text pasted from a word processor that inserted smart quotes.
- Stripping HTML out of content copied from a web page.
- Collapsing irregular whitespace before a diff.
- Removing invisible junk characters that break a parser.
- Preparing pasted text for a field that only accepts ASCII.
Frequently Asked Questions
- What does each option do?
- Trim removes whitespace from the two ends of every line; normalise whitespace collapses runs of spaces and tabs *inside* a line to one; remove empty lines drops lines that are blank after trimming. They compose, and the order they run in is fixed so the result is predictable.
- Why is my text still messy?
- Because the culprit is probably invisible. Non-breaking spaces (U+00A0), zero-width spaces (U+200B) and narrow no-break spaces survive a whitespace collapse in many implementations because they are not ordinary spaces. Inspect the code points if a trim looks like it did nothing.
- Will it break my Markdown or code?
- It can. Markdown uses two trailing spaces for a hard line break and leading spaces for a code block, and in Python indentation is syntax. Trimming and collapsing are safe on prose and destructive on anything where whitespace carries meaning.
- Does it fix line endings?
- Trimming removes a stray carriage return at the end of a line as a side effect, since `\r` is whitespace. If converting CRLF to LF is the actual goal, use a line-ending converter — that way the intent is explicit and the result is not a side effect.
- What is this most useful for?
- Text pasted out of a PDF, an email or a web page, which arrives with hard-wrapped lines, doubled spaces after full stops, and blank lines where the layout had gaps. Cleaning first makes everything downstream — diffing, counting, searching — behave.
Common errors and gotchas
- Normalising quotes in code or in a regex, where the exact character matters.
- Collapsing whitespace inside a preformatted block, which changes the content.
- Removing characters you needed, such as a non-breaking space that was deliberate.
- Stripping HTML from text that was meant to be markup.
- Assuming a clean result is valid, when cleaning fixes appearance rather than structure.
Related Text Tools tools
Case Converter
Convert between Sentence, Title, camelCase, snake_case, and more.
Word Counter
Count words, characters, and analyze keyword density.
Text to Binary
Convert text into its 8-bit binary representation.
Binary to Text
Decode 8-bit binary back into readable text.
Text Reverser
Reverse text by characters, words, or lines.
Remove Duplicate Lines
Delete repeated lines and keep your list unique.
Remove Empty Lines
Strip blank and whitespace-only lines from text.
Sort Lines Alphabetically
Sort lines A–Z or Z–A, case-sensitive or not.