HTML Formatter / Beautifier

Format messy HTML into readable indented output, or minify formatted HTML for production. Configurable indent size and attribute-wrapping rules. Useful for inspecting minified pages, cleaning up emitted HTML, or preparing snippets for documentation.

How to use the HTML Formatter / Beautifier

Paste any HTML — full document or fragment. Format produces indented output with self-closing tags handled correctly. Minify removes unnecessary whitespace while preserving spaces inside <pre> and <textarea> where whitespace is significant.

When to format vs minify

Format for reading: code review, debugging an unexpected layout, or pasting into documentation. Minify for production: trimming bytes from HTML payloads, removing the gap between what your CMS emits and what browsers actually need.

Modern build pipelines minify HTML automatically (Vite, Next.js, Astro all do it by default), so this tool is mostly useful for ad-hoc work — a snippet you got from a CMS export, an HTML fragment from an LLM, the source of a page you're reverse-engineering.

Frequently asked questions

Does formatting change how my HTML renders?

No. It only adds or removes whitespace between tags, which browsers ignore. The rendered page is identical; only readability changes.

Can it handle minified or broken HTML?

It reindents minified HTML reliably. It is a formatter, not a validator, so it will reformat malformed markup as-is rather than fixing structural errors.

Is my HTML uploaded to a server?

No. Formatting runs entirely in your browser, so your markup never leaves your machine.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: