Free HTML Formatter

Beautify minified or inconsistently indented HTML into a clean, readable structure, entirely in your browser.

How to format HTML

  1. 1

    Paste your HTML

    Paste minified or messy HTML markup into the input box.

  2. 2

    Click "Format →"

    The markup is reparsed and reprinted with consistent, nested indentation.

  3. 3

    Copy the result

    Click "Copy output" to grab the formatted HTML for your template, email, or codebase.

Example use cases

1

Reading minified page source

Paste in HTML copied from "View Source" on a production site to see its structure clearly.

2

Cleaning up a component template

Reformat markup pasted from a design tool or generated by a template engine before committing it.

3

Preparing HTML for an email template

Tidy up nested table-based email markup so it's easier to review and edit by hand.

Frequently asked questions

What does this formatter do?

It parses your HTML and re-prints it with one element per line and consistent nested indentation, making minified or inconsistently formatted markup easier to scan and edit.

Does it validate my HTML?

No. It reformats structure only — it doesn't check for accessibility issues, invalid nesting, or missing closing tags beyond what the browser's own HTML parser tolerates.

What happens to inline elements like <span> or <b>?

Inline-level tags are kept on the same line as their surrounding text where possible, so sentences don't get needlessly fragmented across many lines.

Is my markup uploaded anywhere?

No. Formatting happens locally in your browser using the DOM parser built into JavaScript — nothing you paste is sent to a server.