Minify CSS, JS and HTML

Minify CSS, JavaScript and HTML to shrink file size and speed up your pages. This free online code minifier strips comments and collapses insignificant whitespace, then shows a clear before-and-after size comparison so you can see exactly how many KB you saved. Pick a language, paste or type your code, click Minify, and copy the compressed output. It is a conservative, lightweight minifier that favours keeping your code intact over the most aggressive size cuts. Everything runs 100% in your browser, so your source code is never uploaded and never leaves your device.

🔒 100% private — files never leave your device

Loading…

How to use

  1. Choose the language: CSS, JS or HTML.
  2. Paste or type your code into the input box.
  3. Click Minify to strip comments and collapse whitespace.
  4. Check the size savings, then copy the minified output.

Frequently asked questions

Which languages can I minify?

CSS, JavaScript and HTML. For CSS it removes /* */ comments, for JS it removes // line and /* */ block comments, and for HTML it removes <!-- --> comments, then each collapses redundant whitespace to shrink the code.

Is my code uploaded anywhere?

No. Minifying happens entirely in your browser and your code is never uploaded. It runs 100% locally, so nothing you paste ever leaves your device.

How thorough is the minifier?

It is a lightweight, scanner-based minifier that removes comments and collapses insignificant whitespace. It does not fully parse or rewrite your code, so it favours leaving your code intact over the most aggressive size reductions.

Will it break my JavaScript?

For most code it is safe: the scanner leaves the contents of '…', "…" and `…` strings, regex literals and template literals untouched, and it keeps newlines so Automatic Semicolon Insertion is not broken. Since it does not run a full parser, always test the output before shipping.

Is CSS with calc(), url() and media queries handled correctly?

Yes. Quoted strings and url(...) values are copied verbatim, and it never trims around + - * / so calc() stays intact. It is deliberately conservative around colons and combinators to avoid corrupting valid CSS.

How much smaller will my code get?

It depends on how many comments and how much whitespace your code has. After you click Minify, the tool shows the original versus minified size in KB along with the percentage saved, so you can see the exact result.

About this tool

Free online CSS, JavaScript and HTML minifier. Remove comments and extra whitespace, see before/after size and savings, then copy — 100% in your browser, no uploads.

Related tools