HTML beautifier

Free online HTML beautifier and minifier. Format and compress HTML code with customizable indentation.

Indent

How it works

  1. 1

    Paste the HTML code

    Copy your HTML markup and paste it into the input field, even if it's on a single line or unindented.

  2. 2

    Choose Format or Minify

    Click Format to indent with readable hierarchy (the tool recognizes void tags like br, img, input) or Minify to compress into one line.

  3. 3

    Copy the result

    Check the size and savings statistics, then copy the transformed HTML to the clipboard with one click.

FAQ

Does the formatter handle invalid HTML?

The formatter does its best to indent even imperfect HTML, but for optimal results the code should have matching opening and closing tags.

Are HTML comments preserved?

In formatting yes, in minification they are removed to reduce file size.

Can I use it for XML?

For simple XML yes, since the structure is similar. For complex XML it might not perfectly handle all cases.