Skip to content
TinySolve

HTML Formatter

Indent minified or messy HTML into something readable.

Runs in your browser — nothing you type is sent anywhere

Indentation

Formatted

The result appears here as you type. Nothing is sent anywhere — the work happens in this page.

Whitespace matters inside inline elements, so the formatter will not add a line break where doing so would change how the page renders. A fragment works as well as a full document.

About the HTML Formatter

Minified HTML is a single line thousands of characters long, and HTML produced by a template engine or a CMS is often worse — indented, but by nothing consistent. Either way, working out what is nested inside what means counting tags by hand.

This reindents it properly, using the same formatter that runs in most editors, so the result matches what your colleagues' tools would produce rather than being one more style to argue about.

The important subtlety is inline elements. Whitespace is significant inside a paragraph: putting a link on its own line inserts a space that was not there before, and can visibly change the rendered text. The formatter knows which elements are inline and will not break a line where doing so would change what the page looks like. That is the difference between a formatter and a naive indenter.

A fragment works as well as a complete document, so you can paste the one block you are working on rather than the whole page. Attributes are wrapped when a tag is long, which is what makes a complex element readable.

The parser runs in your browser and is downloaded only when you press the button, so nothing is uploaded and a visitor who reads the page and leaves downloads none of it.

How to use the HTML Formatter

  1. Paste your HTML

    A full document or a single fragment — both work.

  2. Choose the indentation

    Two spaces, four spaces or tabs, to match whatever the rest of the project uses.

  3. Format it

    The parser downloads on the first press and stays for the rest of your visit.

  4. Copy or download

    Take the result to the clipboard, or save it as an .html file.

Frequently asked questions

Will formatting change how my page looks?
No. Whitespace is significant inside inline elements, and the formatter will not break a line where doing so would insert a visible space. That is exactly what a naive indenter gets wrong.
Can I format just a fragment?
Yes. A single element or a block from the middle of a page formats fine — there is no need for a complete document with a doctype.
Does it fix broken HTML?
Not really. It is a formatter, not a repair tool. Badly mismatched tags will either be reported or formatted according to how the parser resolves them, which may not be what you meant.
Does it handle templates?
Plain HTML and most attribute syntax, yes. Template languages that embed their own expressions in the markup — Handlebars, Jinja, Blade — can confuse it, since they are not HTML.
Is my HTML uploaded?
No. The formatter runs in your browser, and is only downloaded when you press the button.