Code Minifier

Strip comments and unnecessary whitespace from CSS, HTML or JavaScript, and see how many bytes you saved.

Language

Result

Comments and redundant whitespace only. Strings, url() values and the spaces inside calc() are left exactly as written, because calc(100% - 10px) is invalid without them.

Runs entirely in your browser — nothing you paste is uploaded or stored.

About code minifier

Minifying removes what only humans need: comments, indentation and line breaks. On CSS and HTML that alone typically saves 20–40%, which is worth having on anything you inline into a page.

This is deliberately a conservative minifier. It removes comments and collapses whitespace while leaving strings, template literals and regular expressions untouched — it does not rename variables or restructure code, because those are the transformations that break things.

Good to know

  • String literals, template literals, regular expressions and CSS url() values are all preserved exactly, which is what separates a safe minifier from a find-and-replace.
  • JavaScript is whitespace- and comment-stripped only. It is not mangled or tree-shaken — for production bundles use esbuild, terser or your build tool, which can do those safely with a full parse.
  • JavaScript without semicolons relies on newlines to end statements, so those newlines are kept. A file that omits semicolons will minify less aggressively, on purpose.

Frequently Asked Questions

Related Tools