Overview
Re-indents messy or minified HTML into readable form using a block-element-aware indenter. Around thirty block-level tags such as div, section, table, form, and headings control indentation depth, while inline content stays on its own line unwrapped. The output appears live next to the input, with copy and download buttons for the formatted file.
How It Works
Paste HTML into the left panel; formatting happens automatically as you type. Tags in the block set increase the indent when they open and decrease it when they close, with guards so indenting never goes negative and self-closing or same-line-closing tags do not double-indent. Inline elements and text are preserved as-is on their line. Copy the result or download it as formatted.html from the output panel.
Step-by-Step Usage Guide
- Paste the HTML you want to beautify into the input panel.
- Watch the indented output appear live on the right.
- Spot-check lines around attributes or text containing > characters, where the split heuristic can misfire.
- Copy the result or download it as a .html file.
Technical Specifications & Standards
The formatter is a two-pass line indenter rather than a DOM parser, and that choice explains both its speed and its failure modes. First, the source is split at every tag boundary by inserting newlines between > and <, so minified one-line documents become one tag per line. Then each line is classified: a closing block tag drops the indent before printing, an opening block tag prints and raises the indent, and a tag that both opens and closes on the line, or self-closes, leaves the depth unchanged. Void elements are handled by the self-close guard. Because no DOM is built, the formatter cannot know that a > sits inside an attribute value or inside text content; a comparison like a > b in text, or an attribute containing >, will be treated as a tag boundary and the indentation after it can be wrong, so review output with unusual text. The block set is fixed and excludes some structural tags such as dl, dt, dd, option, and select, which therefore do not affect depth; lists and tables, the most common indentation traps, are covered. Inline tags like span, a, and em deliberately do not indent, keeping short inline groups on one line instead of exploding them vertically.
Targeted Use Cases
- Beautifying minified production HTML before editing or diffing it.
- Normalizing indentation in template files from different contributors or generators.
- Preparing readable markup for a code review or a documentation example.
- Untangling a one-line export from a website copier or an email template builder.
Notes & Gotchas
- Skim the output for lines around text or attribute values containing >; the formatter splits at tag boundaries textually.
- Do not use this as a sanitizer or validator; it changes whitespace only and neither removes nor reports invalid markup.
- Expect inline elements to stay unindented by design; forcing them onto their own lines is not what this tool optimizes for.
- Re-format after editing minified sources rather than editing the minified version, so diffs against the original stay meaningful.
Frequently Asked Questions
Which tags trigger indentation?
A fixed set of about thirty block-level tags: html, head, body, header, footer, main, section, article, aside, nav, div, ul, ol, li, table parts, form, fieldset, p, headings, pre, blockquote, figure, figcaption, details, summary, and dialog. Inline tags do not change the indent level.
Why did my text with a > character get split?
The formatter inserts line breaks between every > and < before classifying lines, so a greater-than sign inside text or an attribute value is treated like a tag boundary and indentation after that point can be off. Review such spots manually.
Does it validate or fix my HTML?
No. It only re-indents. Unclosed tags, nesting mistakes, and invalid markup pass through untouched, so run a validator separately if correctness matters.
Will it break inline elements onto separate lines?
No. Inline tags such as span, a, and em are deliberately excluded from the block set, so inline runs stay together on one line rather than being exploded vertically.