HTML Formatter / Minifier / Validator

Format, minify and structurally validate HTML safely — nothing leaves your browser.

Category: Developer Tools

Input

All processing stays in your browser. Your markup is never executed, never rendered and never uploaded, and the input is never replaced by its result.

Indentation for Format

Result

Format and minify rewrite whitespace at block-level boundaries only; your text, attribute bytes, entities and comments are otherwise verbatim. Validate reports structural findings with exact positions — it is not a full standards conformance check (element content models, ARIA, CSS/JS inside style/script, encoding need a real checker such as the W3C Nu HTML Checker).

Downloads: formatted.html after Format, minified.html after Minify, validation-report.txt after Validate. Frozen regions (pre, script, style, xmp, listing, plaintext, textarea, title, svg, math) are copied byte-for-byte in every mode and never re-indented or collapsed.

About this tool

HTML Formatter does three separate jobs locally: re-indenting your source (Format), removing only whitespace and comments that demonstrably cannot change rendering (Minify), and reporting exactly where the browser parser would repair your markup (Validate).

  • Format with 2 spaces, 4 spaces, or Tab indentation; rewrite only safe structural whitespace.
  • Minify conservatively — remove whitespace/comments only where safe; preserve frozen regions byte-for-byte.
  • Validate structure with the browser parser; report findings with exact positions.
  • Preserve comments, CDATA, DOCTYPE where present, entities, and frozen elements (pre/script/style/textarea).
  • Never execute HTML; formatting verified against parser oracle when possible.
  • Copy input/result, swap, clear, download formatted.html/minified.html/validation-report.txt; 1 MB limit.

Details worth knowing: formatting checks its own output against the browser's HTML parser before showing it — if the transformed source would not parse to the same element and attribute structure as your input, the result is refused instead of displayed, so a bug can never silently alter your document. Minify never touches text edge whitespace except next to block-level boundaries, keeps bogus comments and CDATA sections byte-for-byte, and counts every comment it removes. Validate deliberately does not claim conformance: the browser silently repairs malformed HTML (auto-closing elements, rebuilding trees, dropping duplicate attributes), so findings tell you where that would happen, and a real checker (Nu HTML Checker) remains the authority for full standards compliance. Malformed or incomplete input is still preserved byte-for-byte in the output — the tool repairs nothing, it only reports. Inputs above 1 million characters are refused.