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
Paste your HTML into the input box.
Choose Beautify to indent it or Minify to compress it.
Pick the indent size, then copy the result.
Frequently asked questions
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.
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.
No. Both beautify and minify run entirely in your browser, so your markup never leaves your device.
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
Generate SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text, right in your browser.
Convert colors between HEX, RGB and HSL with a live preview.
Convert Unix timestamps to human dates and back — UTC, local, ISO 8601 and relative time. Seconds and milliseconds are auto-detected.
Percent-encode and decode URLs and URL components, UTF-8 safe.
We use essential cookies to run the site. With your consent we also load Google AdSense, which sets advertising cookies. See our privacy policy.