5.0 out of 5 — 131884 votes

HTML Formatter — unminify and beautify HTML

Turn minified HTML back into readable markup.

This HTML formatter takes tangled or minified markup and returns it properly indented: nested tags stepped in, sibling tags aligned, one element per line where it belongs. Paste, format, read.

How to use HTML Formatter

Paste the markup — a page source copied from the browser, template output, an email layout. Format it and follow the indentation: each level of nesting steps one level right. Copy the result back, or use the readable view just to find what you came for.

Formatted markup is mostly for humans, and that is the point. Browsers happily render a page whose source is a single line, but the person who has to change that page next Tuesday will not be happy at all.

What indentation actually catches

HTML is forgiving at render time and merciless at edit time. A block closed in the wrong place still displays something — often something almost right — and the error hides until a later change lands inside the wrong container. Indentation turns that class of bug into geometry: when a closing tag doesn't line up under its opener, you see it before you ship it.

Mis-nested lists and tables reveal themselves as stairs that never come back down. Blocks pasted from different sources stop pretending they are one coherent document. Deeply nested wrappers become visible and countable, which is the first step to deleting a few.

HTML forgives an unclosed tag the way thin ice forgives a skater: quietly, repeatedly, and then all at once.

Why paste into a browser tool at all?

Your editor formats the files it owns. The markup you meet in the wild — a page source you're auditing, a CMS export, a newsletter someone assembled years ago — lives outside any project, and opening an IDE for a one-off read is ceremony. An html formatter online is the middle path: paste from anywhere, read immediately, install nothing. Everything happens in the tab; the markup is not uploaded and not kept.

Templates are a special case

Markup from a templating engine is often not valid HTML on its own: a loop opens a tag in one branch and closes it in another. Formatters make a reasonable guess and sometimes indent oddly. That is a limitation of formatting half a document, not a bug in your template. Format the rendered output instead — view source on the live page and paste that.

Questions and answers

Will it fix my broken markup?
It formats; it doesn't repair. But most "broken" HTML is really lost structure, and once the structure is visible, the repair is a thirty-second job you do yourself — in the right place.
Does formatting change how the page renders?
Almost never. Whitespace between tags is collapsed by browsers, with rare exceptions like preformatted text blocks, which careful reformatting leaves untouched.
Can I format a whole page copied from view-source?
Yes — that is the classic use. Copy the entire source, paste it here, and read the skeleton of someone else's page the way its author never let you.
All pages