Rich text cleaner and word stats
Cleans pasted rich text against a whitelist: paragraphs, bold, lists and links survive, script/style blocks are dropped with their content, attributes are stripped except link href (javascript: is blanked), and characters, words and tag counts are reported with HTML or plain-text export.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Cleaned result
Whitelisted tags are kept, other tags are unwrapped, script/style blocks are removed with their content, and attributes are dropped except link href — javascript: URLs are blanked.
Paste rich text source to see the cleaned result
What this tool does
- Clean content copied from a web page or Word first: paragraphs, bold and lists survive while style, class and onclick are stripped, so pasting elsewhere no longer drags styling along.
- Check whether a snippet hides scripts or event attributes: script/style blocks are removed with their content and the "blocks dropped" counter reports how many.
- Estimate the finished length from the character and word counts, then export the cleaned HTML or plain text as a file for the next step.
Example
Input
<p>Hello <b>world</b></p><script>alert(1)</script>
Output
<p>Hello <b>world</b></p>
Defaults are the basic whitelist and cleaned HTML: p and b survive, the script block is removed with its content, so the stats read 11 characters, 2 words, 4 tags kept and 1 block dropped.
Frequently asked questions
Which tags are on the whitelist?
The basic level keeps p, br, strong, b, em, i, u, s, ul, ol, li, blockquote, h1-h4, a, code, pre and hr; the strict level keeps only p, br, strong, em, ul, ol and li. Everything else is unwrapped: the tag disappears and its text stays, so <div>text</div> becomes text.
Why are script and style removed together with their content?
Because their text is code or styling rather than prose. script, style, iframe, object, embed, svg, math, template, noscript, textarea, title, head, select, option and form are deleted as whole blocks, and each one is counted in "blocks dropped".
How are attributes handled?
Only href and title on <a> survive; every other attribute (style, class, id, data-*, on* handlers and so on) is dropped. href is protocol-checked: javascript:, data: and vbscript: URLs are blanked to a bare <a> and not counted, while http(s), mailto, relative paths and # anchors are kept. You can also turn "keep link href" off to drop href entirely.
Is this a security sanitiser?
No — treat it as a convenience cleaner, not a security boundary, and re-sanitise on the server. The implementation scans tags with regular expressions, so an unescaped > inside an attribute value can throw it off. It is fine for tidying pasted rich text, not for untrusted input.
How are characters and words counted?
Both count the text after tags are stripped: characters are Unicode code points (spaces and line breaks included) and words are whitespace-separated runs, so a paragraph of Chinese counts as one word. HTML entities are not decoded — stays as-is in the result.
Does it support collaborative editing, cloud saving or cursor state?
No. This is not an editor: there is no cursor, undo stack, collaboration or cloud storage. It only cleans, counts and exports HTML or plain text, and the export uses a normal browser download.
Keywords:rich text cleanerHTML sanitizerstrip tags