HTML / CSS Minifier
Minify HTML and CSS online for free — paste your code to instantly remove comments, collapse whitespace, and shrink file size. No sign-up, no account, nothing leaves your browser.
How It Works
Pick HTML or CSS
Choose the mode that matches your code. Switching modes clears the input so you always start with a clean slate.
Paste your code
Drop any HTML or CSS into the input panel. Minified output appears instantly in the right panel — your code stays entirely in your browser.
Copy and deploy
Click Copy output to grab the minified code. The stats bar shows exactly how many bytes you saved and the percentage reduction.
How to Minify HTML and CSS Online
- Select HTML or CSS mode using the toggle at the top of the tool.
- Paste or type your code into the left-hand input panel. The minified version appears instantly on the right.
- Click Copy output to send the result to your clipboard, ready to deploy.
Features
- Instant minification: Output updates as you type — no button to press.
- HTML comment removal: All standard HTML comments are stripped. IE conditional comments are preserved.
- CSS comment removal: Block comments (
/* … */) are fully removed. - Whitespace collapsing: Redundant spaces, tabs, and blank lines are collapsed to the minimum required.
- Real-time savings stats: See original size, minified size, and percentage reduction as you work.
- Load sample: Built-in sample HTML and CSS let you test the tool straight away.
- Your code stays private: Everything runs in your browser — nothing is uploaded, stored, or logged.
- No account required: Open the page and start minifying straight away.
- Works offline: Pure JavaScript — once the page has loaded, no network connection is needed.
Frequently Asked Questions
Is my HTML or CSS code uploaded to your servers?
No. All minification happens locally in your browser using JavaScript. Your code never leaves your device and is never sent to or stored on any server.
Is this HTML CSS minifier free to use?
Yes, completely free — no account, no sign-up, and no usage limits.
What does the HTML minifier remove?
It removes HTML comments, collapses whitespace between tags, and trims leading and trailing whitespace from each line. IE conditional comments (<!--[if …]>) are preserved. The resulting HTML is functionally identical to the original.
What does the CSS minifier remove?
It removes block comments (/* … */), collapses whitespace around structural characters like { } : ; ,, and strips the trailing semicolon before a closing brace. The minified CSS is functionally identical to the original.
Will minifying my code break anything?
No. The minifier only removes whitespace and comments — it never alters selectors, property values, or HTML attributes. The output is semantically identical to the input and safe to deploy.
Does the minifier work offline?
Yes. The tool is pure client-side JavaScript — once the page has loaded, it works without an internet connection.