Skip to content
QKQuickKit日本語
HTTP & WebLOCALRuns in your browser

HTML Formatter

Re-indent a bounded HTML snippet with two-space nesting, preserving <pre>, <textarea>, <script>, and <style> content verbatim.

This tool handles input and primary processing in your browser and is designed not to send the input to QuickKit’s server.

Formatted output

How it works

This is a structural pretty-printer, not a parser, sanitizer, or validator. It never executes scripts, resolves entities, fetches resources, or changes attribute values. The tag scanner is quote-aware: a ">" inside a quoted attribute value does not end the tag, and quoted attribute values — including whitespace inside them — are copied through unchanged; only whitespace *between* attributes is collapsed. It tokenizes tags, comments, the doctype, raw-text elements, and text runs, then re-emits with two-space indentation. Void elements (the HTML spec list: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr) and self-closing tags never open a level. A subset of the optional-end-tag rules is applied for list and table items. Text-node whitespace is collapsed to single spaces and trimmed, so the output is NOT safe for whitespace-sensitive inline layout. A <pre>, <textarea>, <script>, or <style> element is emitted as one unit — its start tag is indented, then the body is copied through code-unit-for-code-unit (no CR/LF rewrite, no blank-line trimming, no reindentation, no newline before the end tag), so re-parsing the output yields the same raw text. Comment text and the doctype (including quoted PUBLIC/SYSTEM identifiers) are likewise kept exactly as written. Mismatched or missing end tags are handled leniently and reported as "not balanced" rather than rejected. Input is capped at 256 KiB.