HTML Prettifier (Indent, Format)

Take messy or minified HTML and reformat with proper indentation. Block elements get newlines, inline elements stay on the same line, attributes wrap if too long.

How to use the HTML Prettifier (Indent, Format)

Paste messy or minified HTML, choose the indent width, and the beautified markup appears below — block elements indented onto their own lines, inline elements kept in the text flow. Copy the result.

Beautifying HTML

HTML that comes back from a build step, a CMS export, or a “view source” on a production page is frequently minified to a single line, and a naive re-indent that puts every tag on its own line breaks inline flow — pushing the space-sensitive content inside a sentence onto separate lines and changing how it renders.

This beautifies HTML with proper indentation while respecting the block/inline distinction, so block elements get their own lines and indentation but inline elements such as <strong> and <a> stay in the text flow. For attribute-wrapping controls, a max line length, and a minify direction, the HTML formatter is the fuller tool; to shrink markup for production instead, use the HTML minifier.

Common use cases

  • Read minified markup — expand a one-line page into indented HTML.
  • Inspect a CMS export — make generated markup legible.
  • Keep inline flow — indent blocks without splitting inline elements.
  • Pick your indent — 2 spaces, 4 spaces, or tabs.
  • Pre-review tidy — format a fragment before pasting into a diff.

Frequently asked questions

Does it keep inline elements on one line?

Yes — block elements are indented onto their own lines while inline elements stay in the text flow.

Can it minify HTML too?

No — for the minify direction use the HTML minifier.

What is the difference from the HTML formatter?

This focuses on indentation; the HTML formatter adds attribute wrapping, a max line length, and minify.

Which indent widths are supported?

Two spaces, four spaces, or tabs.
Embed this tool on your site

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