HTML preview & text extraction
Parse HTML with a state-machine tokenizer: text mode extracts visible text (block breaks, br breaks, entity decoding, optional script/style removal); clean mode whitelists tags and strips script/iframe, on* handlers and javascript: URLs into a standalone document an iframe can render.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Result
The result can be copied directly.
Paste HTML to see the result
Characters: 0 · Lines: 0 · Elements: 0 · Attrs removed: 0
What this tool does
- Read the visible text of an HTML fragment to check the copy.
- Sanitize user-submitted rich text into a safe fragment for an iframe.
- Compare the output with and without scripts and styles.
Example
Input
<h1>Title</h1> <p>Hello <b>world</b> & more</p>
Output
Title Hello world & more
Block elements break lines in text mode; the bare `<` in `<p>a < b</p>` stays text.
Frequently asked questions
Does it render the page?
No. Text mode only parses and extracts text; clean mode only emits a document string. Live rendering is done by the page iframe.
What happens to the bare `<` in `<p>a < b</p>`?
It stays text. A regex `<[^>]*>` strip would eat ` < b</p>` as a tag.
What does clean mode remove?
Non-whitelisted tags lose only the tag (their text is kept), plus on* handlers, javascript: URLs and expression() styles.
Is it a full HTML parser?
No. It is a forgiving state-machine tokenizer, not a complete HTML5 tree builder.
Keywords:htmlpreviewsanitizedeveloper