Output will appear here...HTML Minifier & Beautifier compresses HTML documents by removing comments and collapsing the whitespace your templates and editors leave behind β the indentation, blank lines and trailing spaces that browsers ignore but every visitor still downloads. The HTML document is the very first resource in every page load; nothing renders until it arrives, so bytes trimmed here move First Contentful Paint and Time to First Byte-adjacent metrics more directly than almost any other asset. Server-rendered pages and template output routinely shed 10β25% of their size.
The critical detail in HTML minification is knowing what not to touch. This tool masks the contents of <pre>, <textarea>, <script> and <style> elements before doing anything else and restores them byte-for-byte afterwards, so code samples keep their line breaks, textarea defaults keep their formatting, and inline JavaScript and CSS are never rewritten. Quoted attribute values are preserved exactly, and IE conditional comments can be kept even while ordinary comments are stripped β the same discipline a build-time minifier like html-minifier-terser applies.
The beautifier does the reverse: it takes minified or messy markup and re-indents it with nesting-aware structure, keeping inline elements like <span>, <a> and <strong> flowing with their surrounding text instead of exploding every tag onto its own line. Everything runs 100% client-side in your browser β your markup is never uploaded or logged, so scraped pages, CMS exports and proprietary templates are all safe to paste, and the tool keeps working offline.
Drop a fragment, a component template, or a full document into the input area. Both formatted and already-minified markup are accepted.
For minification, toggle comment removal, whitespace collapsing and conditional-comment preservation. For beautifying, choose 2, 4 or 8 space indentation.
Minify compresses the markup while protecting <pre>, <textarea>, <script> and <style> content. Beautify re-indents nested tags and keeps inline elements readable. The savings badge shows exact before/after sizes.
Copy the result to your clipboard, or download it as an .html file ready to deploy or inspect.
<pre>, <textarea>, <script> and <style> contents are masked and restored byte-for-byte β code samples and inline scripts are never mangled
Independent toggles for comment removal, whitespace collapsing and IE conditional comment preservation
Whitespace inside quoted attribute values is preserved exactly, so alt text, data attributes and inline JSON survive intact
Indents nested block elements while keeping inline tags like <span> and <a> flowing with their text; void tags need no closing pair
0 comments
No comments yet. Be the first to share your thoughts!