HTML Minifier
Minify HTML documents by removing whitespace and comments
HTML Minifier removes HTML comments and collapses whitespace between tags, shrinking the file size of your markup without changing how it renders in a browser.
How to use HTML Minifier
- 1
Paste your HTML.
- 2
Click "Minify" to strip comments and whitespace.
- 3
Review the compacted result.
- 4
Copy the minified HTML.
Everything you need to know about minifying HTML
What does minifying do?
Strips unnecessary whitespace and comments from HTML, reducing the size of the initial document a browser downloads — a smaller effect than minifying JS/CSS typically, but still a small, real improvement for page load.
When you actually need this
- Shipping a static HTML page without a build tool already minifying it.
- Reducing bandwidth for a high-traffic static page.
Related Developer Tools
JSON Formatter
Format, validate and beautify JSON with syntax highlighting
JSON Minifier
Minify and compress JSON by removing whitespace
JSON Viewer
Interactive tree view for exploring complex JSON data
XML Formatter
Format and validate XML documents
YAML Formatter
Format, lint and validate YAML files
CSV to JSON
Convert CSV files or data to JSON format
Frequently Asked Questions
Does this change how the page looks when rendered?
No — browsers already collapse most whitespace between tags when rendering, so removing it from the source doesn't change the visible layout; only comments and extra whitespace in the source file are removed.
Will this remove whitespace I actually need, like inside a <pre> block?
Whitespace is collapsed primarily between tags; if your markup depends on specific whitespace being preserved inside content (like in <pre> or textarea), check the output carefully before using it.
Why minify HTML at all?
Smaller file size means slightly faster page loads, especially noticeable on templates with lots of comments or heavily indented markup.
Does this tool send my HTML to a server?
Yes — it's sent to our servers to minify and the result is returned to you; nothing is stored.
Is this tool free to use?
Yes — completely free, with no signup and no usage limits for casual use.