HTML Minifier

Free HTML minifier: compress HTML by removing extra spaces and comments, including inline CSS and JavaScript, and see the size saving.

  • 100% free
  • No sign-up
  • Runs in your browser
or drag & drop a file here (.html, .htm, .xhtml, .shtml). Read in your browser, never uploaded.
Minified HTML
Paste, upload or load HTML code to minify...

Only comments and spaces that cannot change the result are removed; text inside strings, <pre> and <textarea> is kept exactly. Inline <style> and <script> code is minified too.

Webmaster Tools

About the HTML Minifier

The HTML Minifier shrinks HTML by removing comments, line breaks and extra spaces that browsers ignore. CSS inside style tags and JavaScript inside script tags is minified too.

Paste your HTML or upload a file to see the minified result and how much smaller it is. Everything runs in your browser, so your text or code never leaves your device.

How to use this tool

  1. 1Paste your HTML, or upload an .html file.
  2. 2Copy or download the minified HTML.
  3. 3Test the page after replacing it.

Best-practice tips

  • Keep an unminified copy for editing.
  • On WordPress and most CMSs, a caching plugin can minify HTML automatically.
  • Check your HTML weight before and after with the Page Size Checker.

Is minifying HTML worth it?

For most pages it saves a few percent to around 20%, more on pages full of comments and indentation. The bigger wins are usually compression, smaller images and fewer scripts, so do those too. Measure the page with the Page Size Checker and the Website Speed Test.

Answers

HTML Minifier FAQs

It removes comments, line breaks and spaces that browsers do not need, so the page downloads faster.

Related tools

Continue with these related webmaster tools.