106 · Developer Tools

HTML Formatter

Paste HTML to get it back neatly indented, one element per line.

HTML Formatter

How to use the html formatter

  1. Paste your HTML.
  2. Choose 2 spaces, 4 spaces or tabs.
  3. Copy the formatted HTML.

What the formatter keeps as-is

Whitespace matters inside <pre> and <textarea>, and scripts and styles have their own syntax, so their contents are kept exactly as you wrote them. Comments and the doctype stay in place.

Examples

<nav><a href="/">Home</a></nav>

<nav> <a href="/">Home</a> </nav>

<p>Hi</p>

Stays on one line

Questions

Does it fix invalid HTML?

No. It re-indents what you give it. Unclosed tags will make the indentation drift, which can help you spot them.

Is my data uploaded?

No. Everything runs in your browser, so what you paste never leaves your device.