HTML Formatter

Beautify and indent HTML

Format minified or messy HTML with consistent indentation, optional line wrapping, and control over blank lines.
Try an example:

Output will appear here...

About HTML Formatter

How it works

  1. The HTML is tokenised into tags and text by js-beautify.
  2. Each nested element is indented one level deeper; inline elements (<b>, <a>, <span>) stay on the same line as their text.
  3. Long lines can be wrapped at a chosen width.

What you need

  • HTML code.

Tips

  • Paste minified page source to make it readable before debugging.

Runs in your browser. Everything happens in your browser - your code and data are never uploaded.

Frequently asked questions

Does formatting change how the page looks?+

Almost never. Browsers collapse whitespace between tags; only content inside <pre> or elements with white-space CSS rules is sensitive to it, and those are preserved.