Search tools

Find a tool by name or what it does.

HTML Formatter & Beautifier

Beautify messy or minified HTML with indent, line wrap, and line break control.

Beautified live as you type. Nothing leaves your browser.

Format

Indent

Wrap long lines

Line breaks

Keeps your line breaks; runs of blank lines collapse to one.

How to format HTML online

  1. Paste your HTML

    Drop a full document or a fragment into the input. It is beautified automatically a moment after you stop typing.

  2. Pick the style

    Choose 2 or 4 space indentation, wrap long lines at 80 or 120 columns or leave wrapping off, and keep or reflow your line breaks.

  3. Copy the result

    The formatted markup appears in the output area, and Copy HTML puts it on your clipboard.

Why use this tool

Indent, wrap, and line break control

Indent with 2 or 4 spaces, wrap long lines at 80 or 120 columns or leave them unwrapped, and keep or reflow the line breaks in your source.

Fragments and full documents

A snippet without an html or body wrapper formats exactly like complete page source, so component partials and CMS field content work as-is.

Lenient with imperfect markup

Unclosed tags, stray brackets, and odd nesting are indented as written rather than rejected. The tool formats your HTML, it never validates or rewrites it.

Instant as you type

The markup reformats automatically shortly after you stop typing. There is no format button to find.

Markup stays on your device

Formatting runs in your browser. Page source, templates, and unpublished copy are never uploaded.

About this tool

This HTML formatter takes markup that has collapsed into one unreadable line and reprints it with consistent indentation and one element per line. The classic case is page source: production HTML is almost always minified, so if you want to study how a site is built, work out why a scraper broke, or find the element a bug report keeps mentioning, the first step is to unminify it. Paste the source and it is beautified automatically a moment after you stop typing.

It works just as well on markup you are about to hand to someone else. CMS rich text fields and email templates accumulate odd nesting and drifting indentation as they get edited, and tidying them before a review keeps the diff about the change rather than the whitespace. Fragments and full documents are both fine: a snippet with no html or body wrapper formats exactly like complete page source, and imperfect markup with unclosed tags is indented as written instead of rejected.

There is deliberately no minify mode. Whitespace in HTML can be significant: the space between two inline elements is part of the rendered page, so stripping the wrong one visibly changes the layout. Minifying safely takes knowledge of how your markup is styled, which belongs in a build step, not a paste-in tool. This page only formats for readability.

Everything runs in your browser, so unpublished copy, tracking links, and client work never leave your device. If you generate HTML instead of cleaning it, the Markdown to HTML converter produces clean fragments, the CSS formatter does the same job for stylesheets, and the JSON formatter covers the data behind the page.

Frequently asked questions

Does it validate my HTML?
No, it formats only. The tool is deliberately lenient: unclosed tags, stray brackets, and invalid nesting are indented as written rather than rejected, which is what you want when tidying imperfect markup. Markup that formats cleanly is not guaranteed to be valid, so run it through a validator if correctness matters.
Why is there no minify option?
Because whitespace in HTML can be significant. The space between two inline elements is part of the rendered page, so a minifier that removes the wrong one changes how the page looks. Stripping whitespace safely requires knowing how your markup is styled, which is a job for your build pipeline rather than a paste-in tool, so this page only beautifies.
When should I wrap long lines?
Leave wrapping off, the default, when you want each element kept on one line however long it gets; that is the most predictable for diffs. Use 80 columns for markup reviewed side by side or destined for email templates, and 120 columns for modern wide editors. Wrapping only breaks lines that exceed the limit; short lines are left alone.
Is my HTML uploaded anywhere?
No. Formatting runs entirely in your browser and the markup never leaves your device. That matters for HTML more than most text, since page source and templates routinely contain unpublished copy, customer data, and internal URLs.
Is there a size limit?
No fixed limit. Formatting happens in your browser tab, so large documents are bounded by your device memory rather than an upload cap. The output area scrolls instead of stretching the page, so even full page source stays manageable.

Related tools