Code Minifier

Minify JavaScript or CSS by stripping comments and unnecessary whitespace, safely preserving strings, template literals and regex. See the size saved instantly, all in your browser.

Minified

Smaller JavaScript and CSS

Minifying strips comments and unnecessary whitespace to shrink your file. For CSS the rules are collapsed tightly; for JavaScript line breaks are kept where they matter so automatic semicolon insertion is not broken. The JavaScript minifier is string-, template- and regex-aware, so anything inside quotes, backticks or a /regex/ is preserved exactly.

Minification happens in your browser, nothing is uploaded.

What this does

A code minifier strips comments and unnecessary whitespace from JavaScript or CSS to shrink the file, and shows how much you saved.

How to use it

  1. Paste your JavaScript or CSS.
  2. Pick the language.
  3. Minify it.
  4. Copy the smaller output.

How it works

Comments and redundant whitespace are removed while strings, template literals and regex are preserved. It does not rename variables, so the result is safe and easy to verify.

Example

A commented, indented CSS rule collapses to a single compact line.

Sources & methodology

Last updated .

Frequently asked questions

What does minifying remove?

It strips comments and redundant whitespace. For CSS it collapses rules tightly; for JavaScript it keeps line breaks where they matter so automatic semicolon insertion is not broken.

Will it break my strings or regex?

No. The JavaScript minifier is string-, template- and regex-aware, so anything inside quotes, backticks or a /regex/ is left exactly as written.

Is this a full optimiser?

No. It does not rename variables or rewrite code, it only removes comments and whitespace, so the result is safe and easy to verify.

Is my code uploaded?

No. Minification happens entirely in your browser; nothing is sent anywhere.