HTML Viewer & Formatter
Preview HTML safely, format or minify it, and read its element tree.
Loading…
Runs entirely in your browser. Nothing you enter is uploaded or stored on a server.
About this tool
Most HTML viewers online upload your markup to a server, or render it in a frame that runs whatever scripts it contains. This one previews inside a locked sandbox with no ability to run scripts or reach your data, and adds three more modes: a formatter that respects the markup exactly as you wrote it, a minifier, and an element tree that exposes the structure and any tag you forgot to close.
How to use
- 1Paste your markup into the input box.
- 2Choose Preview to see it, Format to tidy it, Minify to compress it, or Structure to read its tree.
- 3In Format mode pick the indent: two spaces, four, or a tab.
- 4Copy the result, or in Structure mode review the most used tags and the nesting depth.
When you need it
- Previewing an email template or an HTML fragment before you use it.
- Tidying markup that arrived compressed onto a single line.
- Finding an unclosed tag that is breaking a page layout.
- Minifying HTML before pasting it into a system with a field length limit.
Frequently asked questions
Do scripts in the markup run in the preview?
No. The frame is sandboxed with scripting disabled, so even markup containing something malicious cannot execute. That is the point: you are previewing markup whose source you may not trust.
Why do external images not appear in the preview?
The page security policy blocks resources from other domains. The upside is that your preview never tells an outside server that you opened this markup. Images embedded as data URIs display normally.
Does formatting change my markup?
It changes whitespace and line breaks only. We deliberately avoid running it through the browser parser, which "repairs" markup — closing missing tags and adding elements you never wrote — so you would get back something different from what you put in.
Is anything I paste uploaded?
Nothing is uploaded. Parsing, formatting and preview all happen inside your page. Disconnect from the internet and it still works.
Related tools
- HTML Entities Encoder / DecoderConvert & to & and back. Optionally escape every non-ASCII character.
- XML Formatter & ValidatorFormat or minify XML and check that it is well formed, with the error explained.
- JSON Formatter & ValidatorFormat, minify and validate JSON. Errors point to the exact position.
- Base64 Encoder / DecoderConvert text to Base64 and back. Handles Arabic and any Unicode text correctly.
- URL Encoder / DecoderPercent-encode and decode URLs, and split a query string into readable lines.
- Unicode Escape / UnescapeTurn Arabic and any Unicode text into \u escapes and back. Essential for JSON and source files.