HTML Minifier & Unminifier
Minify or unminify HTML, XHTML, SVG, PHP templates & more. Compress code for production or paste minified HTML to make it readable again. Smart Insights for accessibility, SEO & performance. Free, real-time, 100% browser-based.
Input
0 chars
Minified Output
0 B
One Tool for All HTML Templates
Unlike basic minifiers, this tool auto-detects and supports 8 template languages: HTML5, XHTML, SVG, XML, PHP Templates, Handlebars/Mustache, EJS, and Jinja2. It recognizes your <?php ?> tags, {{variables}}, <%= expressions %>, and every template syntax — preserving them perfectly during minification or beautification.
Why Minify & Unminify HTML?
Minifying removes unnecessary whitespace, comments, and optional markup from your HTML — making files smaller and faster to download. A typical HTML page can shrink by 15–40% after minification, which directly improves load time and Core Web Vitals scores.
Unminifying (beautifying) does the reverse: it takes compressed HTML that looks like one continuous line and restores proper indentation, line breaks, and formatting. Perfect for reading production code, debugging, or understanding someone else’s minified markup.
Smart Insights — Your Code, Analyzed
Our Smart Insights engine scans your HTML and gives you instant feedback on three key areas:
Accessibility
Detects missing alt attributes on images, missing form labels, and heading hierarchy issues. Helps you build more inclusive web pages.
SEO
Checks for missing <title>, meta descriptions, proper heading structure, and other factors search engines look for.
Performance
Flags inline styles, oversized inline scripts, and render-blocking patterns that could slow down your page.
How to Use — 3 Simple Steps
Paste or Upload Your Code
Paste HTML, XHTML, SVG, or template code into the input panel. Or click Upload to load a file. You can also drag & drop. The tool auto-detects your template language and shows which features it found.
Choose Minify or Unminify
Minify compresses your code for production. Unminify / Beautify does the opposite — paste any compressed HTML and it restores proper indentation and formatting. Toggle advanced options to fine-tune optimizations.
Copy, Download, or Review Insights
Output updates instantly as you type. Copy or download the result. Check the Verified badge, What Changed panel, and Smart Insights for accessibility, SEO, and performance tips.
Optimization Reference
| Optimization | Before | After | What it means |
|---|---|---|---|
| Comments | <!-- note --> | (removed) | Developer notes stripped |
| Whitespace | <p> text </p> | <p> text </p> | Extra spaces collapsed |
| Boolean attrs | checked="checked" | checked | Redundant value removed |
| Optional tags | <li>item</li> | <li>item | Browser adds it anyway |
| Type attrs | type="text/css" | (removed) | Default in HTML5 |
| Empty attrs | class="" | (removed) | Empty values do nothing |
| Attr quotes | class="main" | class=main | Quotes optional for simple values |
Pro Tips
Minify for Production
Always serve minified HTML in production. Combined with gzip, you can reduce transfer size by 60–85%.
Unminify to Debug
Got minified source code? Switch to “Unminify / Beautify” to make it readable. Great for debugging production issues.
Check Smart Insights
The Smart Insights panel catches missing alt tags, heading issues, and performance problems — like a quick automated code review.
Template-Aware
This tool preserves PHP <?php ?>, Handlebars {{braces}}, EJS <%= tags %>, and Jinja2 {% blocks %} perfectly.