HTML Minifier

Compress HTML by stripping whitespace, comments, and redundant markup — free, no signup required.

Input HTML
Minified Output
Original: 0 BMinified: 0 BSaved: 0.0%

HTML Full Form

HTML stands for HyperText Markup Language — the standard markup language used to structure content on the web. Every web page you have ever visited is, at some level, HTML parsed and rendered by your browser.

HTML source is written for humans to read and edit, so it's full of indentation, line breaks, and comments — all of which are discarded by the browser at render time. Minifying HTML strips these away to produce the smallest valid document that renders identically.

What this tool does

  • Strip comments — Removes <!-- ... --> comments (IE conditional comments starting with <!--[if are preserved).
  • Collapse whitespace — Removes indentation, newlines, and redundant spaces between tags.
  • Preserve sensitive blocks — Contents of <pre>, <textarea>, <script>, and <style> are handled correctly so your document still renders identically.
  • Inline CSS & JS minify<style> blocks are CSS-minified and <script> blocks are JS-minified automatically.
  • Byte savings — See original vs minified byte counts and percentage saved.
  • Upload & download — Load a .html file from disk, save the minified result back.

When you need an HTML minifier

  • Production builds — Static-site generators and servers ship smaller documents, which hit the wire faster.
  • Email HTML — Many email clients have size limits; a minified template gives you more room for content.
  • Embedded HTML — When you need to paste an HTML snippet into a JSON payload, a database field, or a CMS template.
  • Lighthouse / PageSpeed — Reducing transferred bytes improves Core Web Vitals, especially for mobile visitors on slow networks.

Privacy

Everything runs locally in your browser. Your HTML is never sent to our servers, not even for analytics. You can use this tool on sensitive drafts, private templates, or enterprise pages without anything leaving your machine.

Frequently Asked Questions

For 99% of documents, no. The minifier preserves <pre>, <textarea>, <script>, and <style> contents verbatim (so code blocks and form inputs stay intact), and it keeps IE conditional comments and CDATA sections. If you rely on whitespace between inline elements (<span> <span>) for visual spacing, add an explicit &nbsp; or CSS margin — the minifier will collapse ambient whitespace between tags.
Yes. Any <style>...</style> block is passed through the CSS minifier and any <script>...</script> block is passed through the JS minifier before being re-embedded. <script type="application/json"> or other non-JS script types are left untouched so embedded JSON payloads are not corrupted.
Hand-authored HTML typically shrinks by 20–40%; templates generated by build tools (which are already compact) shrink by 5–15%. After gzip or brotli the saving is smaller but still real — minification removes tokens the compressor still has to encode. For the biggest wins, minify then let your CDN gzip.
No. All minification runs inside your browser using client-side JavaScript. Nothing is sent to our servers, nothing is logged, and nothing is cached anywhere except your own browser tab. Refresh the page and the content is gone.
Click Beautify to pretty-print any HTML — minified or not — with indentation. The original comments are not recoverable (they are stripped during minify), but the document structure is fully restored and readable again.
After. Minifying template source before variable interpolation can mangle your template syntax (especially whitespace-sensitive languages like Jinja or Liquid). Do the interpolation first, then minify the rendered output as part of your build step.