HTML viewer guide: preview, format and minify
Use this HTML viewer to inspect snippets or full documents, compare their rendered appearance and tidy their source. Formatting and conservative minification edit the source; preview settings only affect the isolated frame. Copy returns the editor text, without the preview-only policy or base element. For security cleanup, use the related HTML cleaner rather than treating formatting as sanitization.
How to preview HTML and control execution
Paste HTML to start a static preview after a 400 ms pause, or disable automatic preview and run it manually. JavaScript is off by default. Enabling it disables automatic preview so edits cannot repeatedly execute scripts. Run starts a fresh frame; editing running script source, changing preview settings, clearing or stopping discards that frame. Stop requires a responsive browser and is not a guaranteed execution deadline.
Formatting, indentation and one-step undo
Choose fragment mode for snippets and full document mode for complete pages. Formatting uses 2, 4 or 8 spaces only in selected containers made up of block elements. It preserves mixed text and separators between inline elements, and protects pre, code, textarea, script, style, foreign namespaces and inline white-space subtrees. An HTML parser may repair malformed nesting, normalize line endings and reserialize entities or attributes. Undo restores the source before the last transform; further manual editing clears this one-step history. This is not XML validation or a lossless source editor.
What conservative minification changes
Minification removes indentation between selected block elements while keeping meaningful inline separators and protected text. Optional comment removal skips protected regions and conditional comments. It does not minify JavaScript or CSS, delete optional tags or remove attribute quotes. Ordinary comments may carry framework instructions, so disable their removal when needed. Ordinary text whitespace compression is separate and off by default; destination CSS and classes can make whitespace significant. Output may not be smaller after HTML serialization.
<span>A</span> <span>B</span>
<pre>first line
second line</pre>
Scripts, sandboxing and external resources
The frame never receives allow-same-origin. Its injected content policy blocks external subresources by default while allowing inline styles and data images. External loading permits HTTP and HTTPS resources; inline scripts require the separate script option. Evaluation, workers, child frames, objects and form submissions remain restricted. Links are inactive, input base elements and meta refresh are removed, and referrers are suppressed. These controls affect preview only. Enabled scripts can still navigate their own frame or use browser resources; this is not a malware sandbox or a network isolation guarantee.
Why images, styles or scripts may not appear
Relative paths need an absolute HTTP or HTTPS resource base URL with external subresources enabled. Without a base, paths resolve against a reserved invalid preview host rather than this tool site. The base affects preview only and must not contain credentials. Resource servers, mixed-content rules, CORS, the input’s own content policy and the preview restrictions can prevent loading. A loaded frame does not prove that every resource or script succeeded. This constrained preview may differ from a deployed page.
Local processing and size limits
The HTML parser is hosted with this site and processes text without creating a live DOM or fetching input resources during formatting. The tool does not upload source or save it in browser storage; shared site resources still load. Preview may make requests when permitted, and script navigation is a separate limitation. Limits are 100,000 input UTF-16 units, 10,000 nodes including template contents, 60 nesting levels and 1,000,000 serialized output units. Processing is bounded on the main thread; arbitrary preview scripts have no guaranteed runtime limit.