HTML Minifier
Compress HTML by stripping comments and whitespace.
Processed locally in your browser. Nothing you enter is uploaded or stored.
- Also minifies inline `<style>` and `<script>` blocks, not just the surrounding markup.
- Removes redundant attributes and shortens the doctype where safe.
- Runs in your browser; markup isn't uploaded.
Why this is private
- Processed locally in your browser. Nothing you enter is uploaded or stored.
- Open your browser's DevTools → Network tab while using this tool — you won't see a request carrying your input, because it never leaves your device.
- Nothing you enter is uploaded to a server or shared with us — the processing happens entirely on your device.
Overview
Compresses HTML by removing comments and collapsing whitespace between tags, and also minifies any inline <style> and <script> content it finds.
How to use it
- 1Paste HTML markup.
- 2The minified output updates automatically.
- 3Copy it or download as .html.
Tips
- Whitespace between inline elements and text can occasionally be visually significant — check the result if your markup relies on a specific space between, say, two `<span>` elements.
Frequently asked questions
What people use it for
Shrink a static HTML page before deploying itStrip comments and whitespace from a hand-written page or email template.
Compress an embedded style or script blockMinify inline CSS/JS along with the surrounding markup in one pass.
Reduce the size of a generated HTML snippetClean up output from a template engine before storing or sending it.
Related guides
- How to read JSON with a tree viewerA tree viewer turns a wall of brackets into a structure you can expand, search and copy paths from. Here's how to use one effectively.
- JSON parse errors explained: 'Unexpected token', 'Expected comma or brace', and the restWhat each common JSON error message actually means, the usual cause, and how to find the spot fast using line and column.
- How to format JSON (and actually understand the errors)JSON looks like a JavaScript object but follows stricter rules. Here's what those rules are and how to read the errors when they're broken.
Related tools
All developer toolsHTML FormatterFormat and indent HTML markup for readability.CSS MinifierCompress CSS by removing dead rules, comments and whitespace.JavaScript MinifierCompress JavaScript with real minification, not just whitespace removal.JSON Viewer & FormatterView, format, validate, edit and beautify JSON with an interactive tree view.
Ready to use HTML Minifier?
HTML Minifier