HTML Formatter, Minifier & Beautifier

Beautify indented HTML markup, or minify it down to one compact line

Input HTML

Beautified HTML

Nothing you paste here is ever uploaded, formatting happens entirely in your browser.

About this tool

This tool works both directions on HTML markup. Beautify mode splits tags apart at every "<", tracking indentation by nesting depth so each opening tag increases the indent for what follows and each closing tag decreases it, turning cramped markup into a readable tree. Minify mode does the opposite: it strips all whitespace between tags to collapse everything onto a single compact line, which is useful for shaving bytes off markup before it ships or for embedding HTML inline somewhere space is tight.

Does minifying change how the HTML renders?

No, removing whitespace between tags doesn't change the DOM structure or visible content for standard block-level markup. Just be cautious with inline elements where whitespace between them is sometimes visually significant (like a space between two inline links).

How does beautify mode decide indentation?

It tracks nesting depth by tag: an opening tag (that isn't self-closing) increases the indent level for everything that follows, and a closing tag decreases it first before printing itself, so indentation reflects how deeply each element is nested.

Does this validate my HTML?

No, it only reformats spacing and indentation based on tag structure, it doesn't check for missing closing tags, invalid nesting, or other HTML validity issues.