HTML Formatter
Beautify HTML with 2-space indentation or minify it — inline elements handled correctly.
How to use this tool
- 1Paste HTML into the left 'Input HTML' panel.
- 2Click 'Format / Beautify' to pretty-print with 2-space indentation, or Minify to compact it.
- 3Copy the result from the right Output panel.
About HTML Formatter
Minified HTML from build tools or CMS exports is hard to read and edit. This formatter applies a custom indentation algorithm that correctly handles the distinction between block and inline elements: block elements (div, p, h1-h6, ul, ol, li, table, etc.) get their own indented lines, while inline elements (a, span, strong, em, code, etc.) stay on the same line as their surrounding content. Self-closing elements (br, hr, img, input, link, meta) don't increase the indent depth. Minify strips all whitespace between tags and collapses runs of whitespace to a single space. The output appears in a side-by-side panel with a Copy button. Developers cleaning up HTML from a WYSIWYG editor, inspecting email template markup, or formatting HTML snippets before committing are the primary users. Runs entirely in your browser.