Follow Us

HTML Minifier

Make your HTML smaller in one click. Removes comments and extra whitespace, and can minify inline <style> and <script> too — while keeping <pre> and <textarea> exactly as they are.

Minified HTML

Runs in your browser — your code is never uploaded. Tip: drop a file on the input box, or press Ctrl + Enter.

How to Minify HTML

Shrink any web page or template in three steps.

1

Paste or Upload HTML

Paste your HTML code, upload an .html file, or drop it on the left box.

2

Pick Options

Choose what to remove. Inline CSS and JavaScript can be minified at the same time.

3

Preview & Download

Check the result with Preview, then copy it or download index.min.html.

Removes

Comments & whitespace

Also minifies

Inline CSS & JS

Preview

See the page live

Privacy

Runs in your browser

Works on

Phone & computer

Price

100% free

What the HTML Minifier Does

Safe changes only — your page looks the same in every browser.

BeforeAfter
<!-- comment -->removed (IE conditional comments are kept)
</div>⏎    <div></div><div>
Hello   worldHello world (one space kept between words)
<script type="text/javascript"><script>
<style> body { margin: 0; } </style><style>body{margin:0}</style>
<pre>, <textarea>kept exactly — spaces there matter

What Can You Use It For?

Popular ways people use HTML Minifier.

Page Speed

Smaller HTML means a faster first load and better Core Web Vitals.

Email Templates

Avoid Gmail clipping long emails (over 102 KB) by shrinking the HTML.

Static Sites & Landing Pages

Minify the final HTML before uploading it to your host.

Widgets & Embeds

Make embed codes shorter and cleaner to share.

Tips for the Best Result

  • Always keep your readable source file — edit that one, then minify again.
  • Use Preview to confirm the page still looks right before you publish.
  • Inline JavaScript must be valid to be minified; if it has an error it is left as it is.
  • Combine with our CSS Minifier and JS Minifier for your external files.

Frequently Asked Questions

Quick answers about HTML Minifier.

It removes comments, line breaks and extra spaces from HTML so the file is smaller and loads faster. The page looks the same.

No. One space is kept between words and inline elements, and the content of <pre> and <textarea> is never changed.

Yes. Tick Minify inline CSS and Minify inline JS to shrink code inside <style> and <script> tags too. JSON and template scripts are left alone.

Usually 10–30%, more for pages with many comments or indented code. The saving is shown under the output.

Simple PHP, Blade or Twig templates usually work, but check the result — the minifier treats template tags as text.

Yes, faster pages are better for users and for Google's page experience signals. The content Google reads does not change.

No. Everything runs in your web browser, so your code and data never leave your device.

Yes — 100% free, with no sign-up and no limits.

Related Free Tools

Ready to Use HTML Minifier?

Scroll up and get your result in seconds. 100% free, no sign-up needed.

Start Now

Ad Blocker Detected

Toolszu provides free access to over 1,000 tools. We rely on minimal ads to maintain our servers and keep improving the site for everyone.

Please pause or disable your ad blocker to continue using Toolszu.