HTML Minifier
Shrink HTML for production by removing whitespace and comments.
Minify HTML for Faster Pages
Smaller HTML downloads faster and renders sooner. This minifier strips comments, collapses redundant whitespace between tags, and trims indentation, while protecting the contents of <pre>, <textarea>, <script>, and <style> so nothing visible changes.
What gets removed
- HTML comments
- Whitespace between tags
- Runs of spaces collapsed to one
- Leading and trailing indentation
What stays safe
Whitespace-sensitive elements like <pre> and <textarea>, plus inline <script> and <style> blocks, are preserved exactly so formatting and code remain intact.
Where minified HTML helps
Minification is most valuable for large, server-rendered pages and email templates where repeated indentation adds up. Combined with gzip or Brotli compression, it measurably reduces transfer size and improves Core Web Vitals.
100% Private & Processed Locally
Every conversion on this page runs entirely inside your browser using JavaScript. Your data is never uploaded to a server, logged, or stored â making this tool safe even for sensitive payloads such as API responses, configuration files, and access tokens.
Because there is no network round-trip, conversions are instant and work even when you are offline. It is free to use with no sign-up, no rate limits, and no ads injected into your output.
Frequently Asked Questions
Common questions about the HTML Minifier.