HTML Minifier
Minify HTML by stripping comments and the whitespace between tags. Free, and runs entirely in your browser — nothing you enter is uploaded or stored.
About Minifier
Minifying removes what a browser does not need: comments, redundant whitespace, and line breaks. For CSS and HTML that is most of the saving; for JavaScript it is the safe subset of what a full build-time minifier does.
The practical uses are inline assets — a critical CSS block, an email template, a snippet embedded in a landing page — where running a whole toolchain is disproportionate but the bytes still count.
Where it helps
- One tool for CSS, HTML and JavaScript.
- Typically removes a large share of a hand-written stylesheet's bytes.
- Ideal for inline blocks that never pass through a bundler.
- Runs locally, so nothing is uploaded to be processed.
Limits
- It does not mangle names, tree-shake or dead-code eliminate the way esbuild or Terser do — expect smaller gains on JavaScript.
- Minified code is hard to debug; keep the readable original in version control.
- Whitespace-sensitive HTML (
<pre>, and spacing between inline elements) can render differently. - Gzip or Brotli on the server already removes much of this redundancy, so the marginal gain is smaller than the raw numbers suggest.
Frequently asked questions
Is this a substitute for a bundler?
No. For application code use esbuild, Terser or your framework's build. This is for one-off snippets and inline assets.
Is minifying safe for JavaScript?
It removes comments and whitespace only, so behaviour is preserved. Always test the output, as you would with any build step.
Why did my HTML render differently after minifying?
Spaces between inline elements are meaningful in HTML. Removing them can close up gaps between links or spans.
Does minifying still matter with compression enabled?
Less than it used to. Gzip and Brotli handle repeated whitespace well, so treat minification as an extra few percent rather than the main event.
Related tools
- JavaScript Formatter — Re-indent JavaScript and TypeScript source
- CSS Formatter — Format stylesheets with consistent indentation
- HTML Formatter — Indent and tidy HTML markup
- Structure Minifier — Strip formatting from JSON, XML, YAML, TOML or TOON
- SCSS/SASS Formatter — Format SCSS syntax and nested rules
- TypeScript Formatter — Format TypeScript source code
More Web Development tools
- HTML Formatter — Indent and tidy HTML markup
- CSS Formatter — Format stylesheets with consistent indentation
- JavaScript Formatter — Re-indent JavaScript and TypeScript source
- SCSS/SASS Formatter — Format SCSS syntax and nested rules
- TypeScript Formatter — Format TypeScript source code
- SQL Formatter — Format SQL statements with dialect selection
- SQL Minifier — Collapse formatted SQL into compact text
- CSS Unit Converter — px, rem, em, percentages and viewport units, with a preview
- Query String Parser and Builder — Convert query strings into editable key-value data
- CSP Generator — Build a Content-Security-Policy, or check one, and write it for your server or framework
- CORS Generator — Write CORS configuration for nginx, Express, Go, Django, ASP.NET, Spring and more, and test an origin against it
- cURL Builder — Build an HTTP request and get it as curl, JavaScript, TypeScript, Go, Python, PHP, C#, Java and more
- Minifier — Shrink CSS, HTML or JavaScript
- Flexbox Playground — Try every flex property and read the CSS back
- CSS Grid Playground — Build a grid template and see the tracks it makes
- Responsive Viewport Tester — Render your markup at phone, tablet and desktop widths
- SVG Path Viewer — Draw path data and read back what it contains
- SVG to CSS Converter — Turn an SVG into a data URI for CSS or an img tag
- OAuth 2.0 / OIDC Helper — PKCE verifiers and challenges, state, nonce, and checking what came back
- Regex Tester — Test patterns, inspect groups and preview replacements
- User-Agent Parser — Identify the browser, engine, operating system and device behind a User-Agent string
- HTTP Status Codes — Look up what a status code means, when to send it, and whether it is cached or safe to retry
- HTML to JSX — Convert HTML and SVG markup into JSX for React, with styles, attributes and whitespace handled
- Semver Checker — Test versions against npm ranges, sort them by precedence, and see what each bump produces
- Cookie Parser and Builder — Read Set-Cookie and Cookie headers, check them against browser rules, and write one for your framework