Home › HTML Formatter — Free Online Tool | Wgajaa

<> HTML Formatter

Indent and tidy messy HTML markup. Free, private and instant — nothing you enter is sent anywhere.

About this tool

Wgajaa's HTML formatter indents and tidies messy markup so you can actually read it. Paste minified templates, copied DOM dumps or hand-rolled HTML, and the tool re-prints each tag on its own line with consistent indentation while preserving your text content exactly.

Inline elements like a, span, strong and em stay on the same line as their surrounding text, so paragraphs do not get shredded onto separate lines. Void elements such as br, img and input are handled correctly, and the whole operation runs locally with no upload.

Indent:

How this tool works

Everything runs locally in your browser — no data is sent to any server. Here is exactly how it works:

  1. Paste your HTML into the left textarea
  2. Press Format — every tag gets its own indented line
  3. Switch indentation between two and four spaces if your style guide prefers it
  4. Copy the tidy output with one click

Frequently Asked Questions

Whitespace-sensitive elements like pre and textarea can shift when re-indented, but for ordinary markup the browser collapses extra whitespace between block elements, so rendering stays the same. Inline text content is preserved on single lines on purpose.

Yes. Every attribute is re-serialized with its original name and value, and quotes are added where needed. Values containing double quotes are escaped so the output remains parseable.

The formatter parses your input as a document and prints the body contents, which is what you almost always want when tidying templates and component markup. Paste a fragment and you get the fragment back, indented.

Splitting a link or an emphasis span across lines inserts whitespace into the rendered text. Keeping inline content on a single line preserves both readability and the exact text your visitors see.

No. Parsing uses the browser's DOMParser and runs entirely in your tab. Nothing is transmitted or stored.

Related Tools

🔒 100% private — runs in your browser
⚡ No uploads — instant results
🆓 Always free — no sign-up
📱 Works on mobile & desktop