MinifyPic

HTML Formatter

Take messy, minified or machine-generated HTML and give it clean indentation you can actually read and edit.

FreeIndentInstant
Loading tool…

How it works

A compact workflow from input to download.

1

Paste your HTML

Drop in markup from a page source, an email template, a CMS export or a build output.

2

Format it

Elements are indented to reflect their nesting, so the document structure becomes visible at a glance.

3

Copy it back

Copy the tidied markup into your editor.

Frequently asked questions

Will formatting break my page?
Almost never, but there is one real caveat: whitespace between inline elements is meaningful in HTML rendering. Adding line breaks around inline tags like span or a can introduce or remove a visible space in the rendered output. Block-level structure is entirely safe to reindent; be a little careful around runs of inline content.
Does it fix invalid HTML?
It formats what you give it rather than repairing it. HTML is famously forgiving — browsers will happily render markup with unclosed tags — so a formatter can indent invalid markup without complaint. If you need to know whether your HTML is actually valid, run it through a validator.
Why is machine-generated HTML so unreadable?
Because it was never meant for you. Build tools, CMS platforms and email template engines minify their output to save bytes, and they have no reason to make it pleasant. Formatting is how you convert it back into something a human can debug.
Is my data sent to a server?
No. Everything runs in JavaScript inside your own browser tab — nothing is uploaded, logged or stored. That is what makes it safe to paste in API responses, config files, tokens and other material you could not send to a third-party service.

Indentation is how you see the tree

HTML is a tree of nested elements, and every hard bug in a layout is ultimately a question about that tree: which element is this div actually inside, where does that section really close, why is this paragraph inheriting styles from a parent I did not expect. Minified markup makes those questions unanswerable by inspection, because the nesting exists but is invisible. Indentation renders the tree directly onto the page — each level of nesting becomes a level of indentation, and a div that closes in the wrong place shows up as a visibly wrong indent. Most misnested-tag bugs that take an hour to find in minified markup take about four seconds to spot once the file is formatted.

The inline whitespace trap

There is one genuine hazard in reformatting HTML that catches people out, and it is worth knowing before you reformat a template you care about. HTML collapses runs of whitespace into a single space, but it does not remove it entirely — and between inline elements, that single space is rendered. So two spans sitting directly against each other with no gap will render with no gap, but if a formatter puts them on separate lines, the newline becomes a space and a visible gap appears. This is why reformatting a navigation bar or a row of inline-block buttons can mysteriously introduce four-pixel gaps between them. Block-level elements are immune, since their whitespace is not rendered; it is only inline content that bites.