View the source of almost any production web page and you will find HTML that arrived minified: hundreds of tags on a handful of enormous lines, no indentation, and structure visible only to a machine. Save such a page for study, receive a template from a build pipeline, or copy markup out of an email builder, and you inherit the same wall of text. The beautifier re-indents it: every nested tag moves to its own line at a depth that reflects the document's real hierarchy, so you can read the structure with your eyes instead of counting brackets.
Paste your HTML and the formatted result appears live. Indentation uses two spaces by default, and the formatter tracks open and close tags through the document to decide depth. The output panel also reports the size change, so you can see exactly how many characters the formatting added. Everything runs locally in your browser; pasted markup, including proprietary templates or client work, never leaves your device. The tool is free, needs no account, and works on mobile.
Formatting changes whitespace only. Tags, attributes, attribute order, text content, and comments are preserved exactly as written, so the beautified document is safe to diff, search, and edit, and pasting it back through a minifier would reproduce a byte-equivalent structure.
What the Beautifier Changes
The core job is re-indentation by tag nesting. Consider a fragment containing a div, a paragraph, and a span, all crammed onto one line. After formatting, the div opens at column zero, the paragraph is indented one level, the span is indented two levels, and each closing tag aligns with its opening tag. A page with a 40 KB minified body typically expands into a few hundred readable lines, which turns an hour of squinting into a minute of scrolling.
| Input state | Typical size | After formatting |
|---|---|---|
| Minified production page, single line | 38,400 bytes | 41,900 bytes, about 900 lines |
| Email template export, 6 long lines | 12,200 bytes | 13,500 bytes, about 260 lines |
| Hand-edited page, inconsistent tabs and spaces | 9,800 bytes | 10,300 bytes, uniform 2-space indent |
The numbers show the trade-off plainly: formatting adds roughly five to ten percent to the byte count, because each new line costs its indentation and a newline character. That overhead is why formatted HTML belongs in your editor and repository, while minified HTML belongs on the wire. The tool shows the before and after sizes for your specific input so you can make the same calculation on your own documents.
How to Use the Beautifier (Step by Step)
- Paste the minified or messy HTML into the input area. Formatting runs immediately, and the size change appears with the result.
- Scroll the output to inspect the structure. Each nesting level steps in by the indent width, and closing tags align with their matches.
- Search within the output for the element you care about; with one tag per line, text search finally works.
- Copy the formatted HTML into your editor, or use it directly for patching a saved page.
The Saved-Page Reading Angle
Saving a page from a browser for reference is a common habit among developers studying a technique, and it always produces the same frustration: the saved markup is minified, so the elegant flexbox layout you wanted to learn from is invisible. Format the saved file here and the structure emerges. You can see which div wraps the grid, which class names repeat across card elements, and where the hidden template blocks live, without a single console command.
The same trick applies to email HTML, which is minified by every major sending platform and additionally stuffed with nested tables. A three-level-deep table cell is nearly impossible to trace in raw form; after formatting, the nesting is readable in seconds. Debugging a broken layout in an email client starts with formatting the source, finding the misplaced cell, and only then making the edit.
What Is Preserved Verbatim
Re-indenting arbitrary HTML naively would corrupt certain elements, and the formatter is explicit about which content it never touches. Inside pre and textarea elements, whitespace is significant: a code sample's newlines and spaces are part of its displayed content, so adding indentation would change what the user sees. Inside script and style elements, the content is code in another language, and the formatter treats each block as an opaque string, moving its opening and closing tags to sensible lines but leaving the interior untouched.
| Element | Why it must not be re-indented | What the tool does |
|---|---|---|
| pre | Whitespace is displayed; indentation would appear on screen | Content copied byte for byte |
| textarea | Default value includes its whitespace | Content copied byte for byte |
| script | JavaScript has its own formatting rules | Tags repositioned, interior untouched |
| style | CSS has its own formatting rules | Tags repositioned, interior untouched |
Comments are preserved with their content intact, which matters when you are reading a saved page because build systems often leave meaningful markers in comments, such as the names of the components that generated each block.
An Honest Note on Scope
This tool is an indenter, not a validating parser. It does not check that your tags are balanced, does not reorder attributes, does not close missing tags, and does not fix malformed nesting. If the input has a stray closing div, the output will have the same stray div, just neatly indented. That limitation is deliberate: silently rewriting structure would make the tool useless for reading documents you need to see exactly as they are, and would risk breaking markup that relies on quirks. When a document is malformed, format it first, and the indentation pattern will usually make the unbalanced tag obvious by eye, because the closing tags stop lining up.
Inline text formatting is another boundary. A paragraph containing a strong tag and an em tag on one flowing line stays on one line; the formatter does not break inline content across lines, because inserting newlines inside flowing text changes rendered spacing in HTML, where whitespace is significant between words. Block-level elements get the line breaks and indentation; inline content stays as the author wrote it.
Tips and Best Practices
- Format saved pages before studying them; the technique you are trying to learn is almost always visible in the indentation structure.
- Keep formatted HTML as your working copy in source control and minify only at deploy time, so diffs stay meaningful.
- If the output looks wrong, check for unbalanced tags in the input; the formatter preserves flaws rather than hiding them.
- Use the size report to confirm you are looking at the document you expected: a much larger than expected size often means pasted content included scripts.
- For documents with very long script blocks, format the HTML here and run the dedicated JavaScript beautifier on the script content separately.
- When patching a saved page, format, edit, and then re-check in the browser, since some saved pages depend on server responses the file does not contain.