Pretty-print messy or minified HTML with proper indentation
Basic formatter — content inside <script>, <style>, <pre> and <textarea> is preserved as-is, not reformatted.
A tool that takes messy, minified, or inconsistently indented HTML and re-indents it so the nesting structure is easy to read, without changing the markup itself.
Paste your HTML.
Pick an indentation style.
Click Format, then copy the result.
Choose 2 spaces, 4 spaces, or a tab character from the dropdown. Changing it after formatting re-runs the format automatically with the new indentation applied.
Regular HTML tags, text, and comments get re-indented based on nesting depth. Content inside
<script>, <style>, <pre>, and
<textarea> is left exactly as written, since reformatting JavaScript, CSS, or
pre-formatted text could silently change what it does or how it looks.
Inline elements like <b>, <a>, or <span> get put
on their own line, the same as block elements — so a short sentence with a bolded word or a link
can turn into several lines of output. It looks more spread out than you might expect, but it doesn't
change how the page renders, since HTML collapses whitespace between elements by default.
No. Prettier fully parses the HTML and understands inline versus block-level elements, so it keeps inline markup compact on one line where it makes sense. This tool uses simpler tag-by-tag indentation and doesn't make that distinction, trading some polish for a much smaller, dependency-free implementation.
Paste in a single-line minified page or HTML with inconsistent indentation from being edited by hand, and the formatter rebuilds consistent, nested indentation from scratch based on the actual tag structure — useful for reading through someone else's minified markup or debugging structure.
No. Prettier fully parses HTML and understands inline versus block elements, so it can keep inline markup compact within a line. This tool does simpler tag-by-tag indentation and puts every element on its own line, inline or not.
Yes. Content inside those four elements is left exactly as written, not reformatted or re-indented, since reformatting JavaScript, CSS, or pre-formatted text could change what it means.
The same as block elements: each one gets its own line. That makes the output more spread out than a formatter that understands inline flow, but it doesn't change how the page actually renders, since HTML collapses whitespace between elements by default.
2 spaces, 4 spaces, or a tab character, selectable from the dropdown before formatting.
It won't error out — indentation depth is clamped so it can't go negative — but unclosed tags mean everything after them may be indented deeper than intended, since there's no closing tag to bring the depth back down.
No. Formatting happens entirely in your browser using JavaScript. Nothing you paste here is uploaded anywhere.