Tools Hub

HTML Formatter & Minifier

Indent messy HTML readably or minify it, with scripts kept verbatim.

Browser onlyYour data never leaves this device.

Runs entirely in your browser. Your markup never leaves this device and is never stored.

Details: Privacy policy

Input

Modes apply live. Nothing is stored.

Mode

Result

No HTML yet.

Paste markup above to transform it.

HTML Formatter and Minifier indents messy markup into something a person can read, or shrinks a finished snippet by collapsing the whitespace between tags. It is deliberately lenient rather than validating: an unclosed tag is left exactly as it arrived, never repaired, never reordered, because a formatter that silently fixes markup teaches you the wrong thing about your own file. Script contents are kept verbatim, so the formatter does not reformat the code that runs. Minification collapses inter-tag whitespace, which is usually what you want and occasionally is not, so the page says plainly that a whitespace-sensitive layout can be affected. Input is capped at a million characters per run. It is most useful for the two situations markup arrives in: a single unreadable line copied out of view-source, and a snippet that has to fit inside a size-constrained field. Nothing is uploaded and nothing is executed. Script and style contents are preserved verbatim, so minifying a page does not rewrite the JavaScript or CSS inside it. Lenient parsing leaves an unclosed tag exactly where it was found instead of repairing or reordering the document, and collapsing whitespace between tags can shift a layout that depends on it.

How to use HTML Formatter & Minifier

  1. Paste HTML and pick format or minify mode.
  2. Choose an indent style for format mode.
  3. Copy or download the result, or clear to start over.

What you get

  • Readably indented markup, or minified markup with the whitespace between tags collapsed.
  • Script contents left verbatim: the formatter does not reformat what runs.
  • Unclosed tags left exactly as they arrived, because the parser is lenient and never repairs or reorders.

When to use HTML Formatter & Minifier

  • Re-indent single-line HTML copied from view-source before reviewing it.
  • Shrink a markup snippet for pasting into a size-constrained field.
  • Inspect a pasted snippet from a template engine by indenting it, while keeping the embedded script readable as written.

Frequently asked questions about HTML Formatter & Minifier

Does the HTML formatter upload my markup?

No. Tokenizing and re-emitting run locally in your browser; nothing is sent, stored, or logged.

Is my JavaScript inside script tags safe?

Yes. Script, style, textarea, and pre blocks pass through byte-identical in both modes — embedded code is never parsed or altered.

Will it fix my broken markup?

No. The parser is intentionally lenient: unclosed tags and stray text are emitted as-is with a warning, never repaired or reordered.

Why did minification change my layout?

Minify collapses whitespace between tags, which HTML renders as spaces. For whitespace-sensitive layouts, keep the formatted version instead.

Guides that compare HTML Formatter & Minifier

⚡Embed HTML Formatter & Minifier on Your Site & Get Badge↓

Embed this in-browser tool into any blog, documentation, or dashboard. Includes an optional dofollow backlink badge to credit Tools Hub.

Height:
<iframe src="https://salaq.com/embed/developers/html-formatter-minifier" title="HTML Formatter & Minifier — Tools Hub" width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden;max-width:100%;" loading="lazy"></iframe>
<p style="font-size:12px;color:#6b7280;margin-top:6px;font-family:system-ui,-apple-system,sans-serif;">Powered by <a href="https://salaq.com/tools/developers/html-formatter-minifier" target="_blank" rel="noopener" style="color:#2563eb;text-decoration:underline;">HTML Formatter & Minifier on Tools Hub</a></p>

Feedback

Send feedback about this tool (placeholder — feedback collection is not wired up yet).