HTML Formatter

Paste HTML on the left. See errors, pretty-print with consistent indent, or open a collapsible tree of its elements.

Runs entirely in your browser. Your input never leaves this tab.

Input

Output

Other tools

Same site, different job. Your input stays in the browser.

What is HTML?

HTML, short for HyperText Markup Language, is the format that every page on the web uses. It uses tags to describe structure, attributes to add data and behaviour, and nesting to describe layout. HTML is forgiving: a browser will render most documents even when the markup has small errors.

How to use this formatter

  • Paste or type HTML in the input pane.
  • The output pane shows the pretty-printed version with a consistent indent.
  • Switch to Tree to browse the document. Attributes and children appear as separate nodes.
  • Format rewrites the markup with two-space indent. Minify emits a single-line version. Copy output grabs the result.
  • Void elements such as <br>, <img>, and <meta> are printed as self-closing tags.

Common HTML issues

  • A tag left open, such as <div> with no </div>.
  • Attributes that use single quotes or no quotes at all.
  • Text that contains a raw <. Escape it as &lt;.
  • Two IDs with the same value. Each ID must be unique in a page.
  • A missing <!doctype html> at the top of the file.

Where HTML is used

HTML is the surface of every web page you see, from a single-file demo to a large web application. It also powers email templates, ebook files, and Markdown export from many tools. Tree view is useful when you want to see where a stray tag is nested.

Runs in your browser

Everything happens on this page. Nothing is uploaded. The parser uses the browser's own DOMParser, so the tree reflects what a browser sees when it loads the page.