๐Ÿ“„ HTML Formatter

Reformat HTML that's been squashed onto one line, or that has broken indentation, into readable code indented according to its tag hierarchy. Useful for reviewing or debugging source code.

How to use

  1. Enter the HTML code you want to format.
  2. Choose an indent width (2 or 4 spaces).
  3. The formatted result appears automatically. Use the "Copy" button to copy it.

FAQ

Does this format the contents of <script> or <style> tags too?

Indentation is applied based on the surrounding tag hierarchy, but the JavaScript or CSS code inside isn't itself reformatted or beautified. Use a dedicated JS/CSS formatter for that.

Could angle brackets inside attribute values be misread?

Normal HTML attributes are fine, but unusual edge-case input could produce an unexpected line break. Treat this as a lightweight formatter rather than a full parser.

Can this also minify HTML?

No โ€” this tool only reformats (adds indentation); it doesn't minify.