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
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
- 1Paste your HTML, or upload an .html file.
- 2Copy or download the minified HTML.
- 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.
Yes, the code inside style and script tags is minified too.
No. It is minified in your browser.
Yes, with no sign-up.
Related tools
Continue with these related webmaster tools.
Meta Tag Generator
Free meta tag generator: create your title tag, meta description, robots and canonical tags with a live Google search preview and character counter.
View Page Source
Free page source viewer: see the HTML source code of any website with line numbers, a search filter and tag counts. Works on any device, including phones.
XML Sitemap Generator
Free XML sitemap generator: crawl your website (up to 5,000 pages) or paste a URL list and download a valid sitemap.xml. Leaves out redirects, errors and noindex pages.