HTML Prettifier Online

Transform compressed, minified or messy HTML into beautifully structured, readable markup. Indent nested elements with consistent spacing, align tag hierarchies and prepare code for review, debugging or documentation. Review formatted output before replacing your original file. Whitespace can be meaningful inside text nodes, so compare the rendered page as well as the indentation. Keep a copy of the original markup for comparison.

Paste and format HTML instantly

Drop your minified or messy HTML into the input area, select your preferred indentation level and click Format. Opening tags increase depth, closing tags decrease it.

Void element handling

Self-closing and void elements like br, img and input are formatted at their current depth without affecting the indentation of sibling elements.

Preserve content integrity

Tag attributes, text nodes, comments and CDATA sections are preserved exactly as they appear. Only whitespace and indentation around tags are modified.

Clean code for review and documentation

Properly indented HTML is easier to review in pull requests, share in documentation and debug in browser developer tools.

Technical references: HTML Reference

HTML Prettifier FAQs

No. Only whitespace and indentation are changed. Text content, attributes and tag structure remain identical.
Yes. Void elements are recognized and indented without creating phantom closing-tag depth changes.
The formatter handles standard HTML. JSX curly braces and component tags may not format as expected.
No. Content inside script and style blocks is preserved as-is. Use dedicated JavaScript or CSS formatters for those.
Files up to 100,000 characters are supported for smooth in-browser formatting.
HTML allows void elements without closing tags, while XML requires strict closing. This formatter handles HTML conventions.
Yes. Comments are indented at their current depth and their content is not modified.
No. All formatting runs locally in your browser.
Yes. The formatted HTML is valid and can be used directly in production websites.