Skip to main content
Website Tools

HTML Minifier

Instantly minify HTML by removing unnecessary whitespace and comments, right in your browser.

Free & instant No signup How to use FAQ
Not sure what to enter?

Paste your HTML below to instantly minify it - entirely in your browser, nothing is sent to our servers.

What does an HTML minifier do?

An HTML minifier removes comments and unnecessary whitespace from HTML so pages are smaller and download faster, without changing how they display. The minifier on this page runs entirely in your browser, so your code is never uploaded.

How to minify HTML

  1. Paste your HTML into the box above.
  2. Click Minify HTML.
  3. Check the size saving, then click Copy Result.
  4. Test the minified page - whitespace inside <pre> and inline elements occasionally matters.

Related checks

The minifier removes HTML comments, indentation, line breaks and the whitespace between tags, while leaving the contents of <pre>, <textarea>, <script> and <style> blocks untouched so code and preformatted text keep working. Removing whitespace between tags can occasionally remove a visible space between inline elements such as two links or buttons, so check the page after minifying it. For the biggest size savings, also enable GZIP or Brotli compression on your server. JustChecker builds tools that respect your data - this one never leaves your browser.

Frequently Asked Questions

No - this tool runs entirely in your browser using JavaScript. Nothing you paste is transmitted anywhere.

Yes - this tool only removes whitespace and comments, and carefully protects the content of <pre>, <textarea>, <script>, and <style> tags where whitespace can be meaningful, so it never changes how your page actually renders.

It depends on how much whitespace and how many comments your original HTML has - typically 5-20% smaller for normally-formatted, human-readable HTML.
Share this tool:
Need a website for your business? Only $599