Monu Tools

HTML Formatter

Beautify HTML with block-aware indentation, or minify it. The contents of pre, textarea, script and style are preserved.

How to use the HTML Formatter

  1. 01

    Paste your HTML into the input box.

  2. 02

    Choose Beautify to indent it or Minify to compress it.

  3. 03

    Pick the indent size, then copy the result.

Frequently asked questions

What does beautifying HTML do?

It indents elements based on their nesting and structure, while leaving the contents of pre, textarea, script and style untouched, since whitespace there is significant.

How does HTML minify work?

It removes comments and collapses runs of whitespace to a single space. It keeps single spaces between tags rather than removing them, because whitespace between inline elements is rendered and dropping it can shift the layout.

Is my HTML sent to a server?

No. Both beautify and minify run entirely in your browser, so your markup never leaves your device.

About this tool

An HTML formatter that beautifies markup with block and inline aware indentation, or minifies it by collapsing whitespace and stripping comments.

The contents of pre, textarea, script and style are preserved, and everything runs locally in your browser.

Related tools

We use essential cookies to run the site. With your consent we also load Google AdSense, which sets advertising cookies. See our privacy policy.