Loading…
Minify HTML for production by stripping whitespace. Use for production builds; for readable HTML use html-formatter. Input: HTML ≤10MB. Returns minified HTML. 100% client-side.
HTML Minifier is loading — interactive editor will appear here. Use examples below to try instantly once loaded.
Press ? for keyboard shortcuts
Minifies HTML using 7 configurable options including comment removal, whitespace stripping, optional tag elimination, quote style normalization, and type attribute removal. Supports preserve selectors to protect specific elements from minification, and shows a size comparison between original and minified output.
Page load speed depends heavily on HTML size, but manual minification is error-prone and hard to maintain. This tool automates aggressive HTML compression while giving control over what to preserve, and quantifies the savings with a visual size comparison.
This tool is part of the DevStackIO platform — a collection of free online developer tools from DevStackIO. Browse more free developer resources on DevStackIO.
Web performance engineers optimizing page load times, deployment pipeline maintainers integrating minification, and developers shipping production HTML assets.
Paste or upload HTML content into the input area
Toggle the 7 options: comments, whitespace, optional tags, quote style, type attrs, etc.
Add preserve selectors using CSS-like selectors to protect elements from minification
Click Minify to process; the tool displays the compressed output alongside the original
Review the size comparison showing original KB, minified KB, and percentage reduction
Copy the minified output for use in your build pipeline or deployment
Input: '<html><!-- comment --><body><p>Hello</p></body></html>' with comments+whitespace removal. Output: '<html><body><p>Hello</p></body></html>' with size comparison showing 40% reduction.Input: '<script type="text/javascript">alert(1)</script>' with type attrs removed. Output: '<script>alert(1)</script>'What size reductions can I expect?
Typically 20-60%, depending on how many options you enable.
Does minification affect SEO?
No, search engines parse minified HTML the same as formatted HTML.
Can I undo minification?
Use the html-formatter tool to beautify minified HTML back to readable form.
Are preserve selectors case-sensitive?
Yes, they follow standard CSS selector case sensitivity.
Authoritative specifications, standards, and in-depth reading for HTML Minifier.
Format and validate HTML with indentation and error reporting. Use as default HTML tool; for minifying production HTML use html-minifier, for converting HTML to Markdown use html-to-markdown. Input: HTML ≤10MB. Returns formatted HTML or validation errors. 100% client-side.
Free online JSON formatter and validator with syntax highlighting and error line numbers. Use as default for beautify+validate+minify in one place; for two-file comparison use json-diff, for schema generation use json-schema-generator. Input: JSON ≤10MB. Returns formatted JSON or line-numbered error. 100% private.
Format or minify CSS with indentation control. Use as default CSS tool handling both directions; css-minifier URL is a noindex alias. Input: CSS ≤10MB. Returns formatted or minified CSS. 100% client-side.
Minify JS for production or beautify minified JS for debugging. Use for JS only; for JSON use json-formatter, for CSS use css-formatter. Input: JS text ≤10MB. Returns minified or beautified JS or syntax error. 100% client-side.
Free online SQL formatter with indentation and keyword casing. Format queries privately in browser.
Format and validate XML with indentation and well-formedness checks. Use for XML; for JSON use json-formatter, for XML to JSON conversion use xml-to-json. Input: XML ≤10MB. Returns formatted XML or line-numbered error. 100% client-side.
Format and validate YAML with syntax checks. Use for YAML editing; for JSON to YAML conversion use json-to-yaml, for TOML/YAML/JSON cross-conversion use toml-converter. Input: YAML ≤10MB. Returns formatted YAML or error. 100% client-side.
Analyze text for word count, readability, and language stats. Paste and get instant insights.