HTML Minifier
Strip whitespace and comments while preserving pre, script and style content
Minified HTML will appear here
Paste HTML above to begin
Advertisement
Minify HTML by removing comments and safe whitespace while preserving pre, textarea, script, and style contents. Compare size and download the result.
Strip whitespace and comments while preserving pre, script and style content
Minified HTML will appear here
Paste HTML above to begin
Remove HTML whitespace and comments (IE conditional comments are kept) to potentially reduce page size. Content inside <pre>, <textarea>, <script>, and <style> tags is left untouched; this tool does not minify the CSS or JavaScript inside those blocks. Shows before/after byte counts and percentage reduction.
What you get with HTML Minifier.
Shows original vs. minified byte count and percentage saved.
Contents of pre, textarea, script, and style tags are preserved untouched.
Output updates as you type or paste — no button press needed.
Follow these steps to get the best results.
Paste your page or template markup into the input — minification runs as you type.
Compare original and minified byte counts and the percentage saved.
Copy the minified HTML or download it as a file for deployment.
Advertisement
Common questions about HTML Minifier.
The tool preserves content inside pre, textarea, script, and style tags exactly as written, since collapsing whitespace there can change rendering or break code. Everything else has whitespace and comments stripped safely.
The reduction varies by document. Pages with heavy inline comments and formatting whitespace may see the biggest savings, while some inputs change very little.
It may reduce bytes transferred, especially when a document contains many comments or formatting spaces. Combine it with gzip or Brotli compression and test the result in your deployment.
No — script and style block contents are intentionally left untouched by this tool. Pair it with the dedicated CSS or JS minifier for those.
Advertisement
Comments
Share feedback, ask questions, or help others use this tool.
Join the discussion
Sign in to comment, reply, and report inappropriate content.