Skip to content
Free tool · runs in your browser

HTML formatter & beautifier

Paste minified, copy-pasted or AI-mangled HTML and get it back one tag per line with consistent indentation — script, style and pre blocks left untouched.

Why format HTML?

Formatting does not change what a page does — browsers ignore the whitespace between tags — but it changes how quickly a human can read it. Minified HTML, a page saved from a CMS, or code pasted out of a chat window often arrives as one enormous line. Putting each block element on its own line and indenting children under their parents makes structural mistakes jump out: a <div> that never closes, a list item outside its list, a script in the wrong place.

What this formatter does (and deliberately does not)

  • Block elements such as div, section, ul, table and head each start a new line and indent their children.
  • Inline elements such as a, strong, span and img stay inside the line of text they belong to, so the spacing you see on the page does not change.
  • Script and style blocks are re-indented as a block but their contents are not reformatted, so no JavaScript or CSS can break.
  • pre and textarea are copied byte for byte, because whitespace inside them is visible on the page.

Format, check, then share

Once the code is readable, run it through the HTML checker for missing tags and broken references, preview it in the HTML viewer, and press Publish as link when it is ready for someone else to see.

Related guides

Frequently asked questions

Will formatting change how my page looks?

No for normal content. Whitespace between block elements is ignored by browsers, and inline elements are kept on the same line so the spaces between words do not move. pre and textarea are left untouched.

Does it fix broken HTML?

It does not add missing closing tags, but indentation makes them obvious: if everything after a point is indented one level too deep, the unclosed tag is just above it. The HTML checker lists them for you.

Is there a size limit?

Only your browser's memory. Formatting runs locally, so multi-megabyte files work; nothing is uploaded.

More free tools

Your HTML deserves a real link

Paste code, drop a file, a ZIP or a whole folder — get a live URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep links online for good.

Turn HTML into a link