HTML formatter

This HTML formatter takes your source code and returns it neatly indented or minified to the essentials. Everything stays in your browser, nothing is uploaded, and pre blocks, scripts and attribute values are left exactly as they are.

Source: WHATWG HTML Living Standard – Syntax: Void-Elemente, Raw-Text-Elemente (script, style), optionale End-Tags. Updated: .

Paste a whole document or just a fragment (up to 500,000 characters).

Your text stays in your browser – it is not sent, not stored and not added to the address bar.

My ToolboxYour inputs are saved in this browser only.

Result

Result
<div class="card"> <h2>Title</h2> <p>A <strong>short</strong> paragraph with some <em>emphasis</em>.</p> <ul> <li>One</li> <li>Two</li> </ul> <hr> </div>
Size
17 tags, 145 → 171 characters.

How it is calculated

How to format HTML

  1. Paste the source into the box – a whole document or just a fragment.
  2. Under “Action” choose Format or Minify and set the indentation if needed.
  3. Copy the result back into your editor.

What formatting does

What minifying does

Runs of spaces and line breaks become one space, and comments are dropped (conditional comments for old browsers stay). Between block elements the whitespace disappears completely; between inline elements one space remains because the browser shows it. CSS inside style is compacted, JavaScript is left untouched.

Honest limits

This is not a full HTML parser: broken code is not repaired but passed through as closely as possible and reported. Templates with server syntax such as {% if %} or <?php ?> may end up with odd indentation.

Frequently asked questions

How can I format HTML online?

Paste the source, choose “Format” and copy the indented result. No account is needed.

Is my HTML code uploaded?

No. Processing happens entirely in your browser; the code is neither sent nor stored.

How do I format HTML in VS Code or Notepad++?

In VS Code press Shift+Alt+F; in Notepad++ a formatting plugin helps. This tool is the quick option when no editor is at hand.

Does minifying change how the page looks?

Normally not: repeated whitespace collapses to one space in the browser anyway. Pre blocks are the exception and stay untouched.

Can I format CSS and JavaScript too?

Styles and scripts inside HTML are indented but not rewritten. For plain CSS there is the CSS minifier, for JSON the JSON formatter.

Sources and legal basis

As of: · Editorial policy

Related tools