HTML Minifier
Shrink HTML by removing comments and whitespace.
Free
Runs in your browser
About this tool
HTML Minifier removes comments and collapses whitespace to make HTML files smaller. Content inside <pre>, <textarea>, <script> and <style> is kept exactly as written.
How to use HTML Minifier
- Paste your HTML.
- Choose whether to keep comments.
- Press “Minify”, then copy or download.
Questions people ask
How much smaller will my HTML be?
Usually 10% to 30% for hand-written HTML. Gzip or Brotli compression on the server saves more, and the two work well together.
Can minifying break a page?
Whitespace between inline elements is collapsed to one space, not removed, so text spacing stays correct. Conditional comments for old IE are kept.
Does it minify inline CSS and JavaScript?
No. Script and style blocks are left untouched to stay safe. Use the CSS and JavaScript minifiers for those.
More developer tools
See all 24 →
CSS MinifierCompress CSS by stripping comments and spaces.
JavaScript MinifierRemove comments and whitespace from JavaScript.
Cron Expression ExplainerExplain cron schedules in plain English with next runs.
JSON to YAMLConvert JSON to clean YAML instantly.
YAML to JSONConvert YAML to formatted or minified JSON.
JSON to CSVTurn a JSON array into a CSV spreadsheet.