WMW

JS/CSS Minifier

Free

Shrinks JavaScript or CSS by removing whitespace and comments, with optional variable name mangling for JavaScript, and before/after size stats.

Runs entirely in your browser. Your code is never uploaded anywhere.

Comments (0)

Found this tool useful? Leave a comment, share a tip, or tell us how we can make it better.

Guest comments are reviewed before publishing. Sign in to post instantly.

No comments yet. Be the first to share your thoughts!

What this tool does

Paste readable JavaScript or CSS and this tool shrinks it by removing whitespace, comments, and (for JavaScript, optionally) shortening local variable names, producing a smaller file with identical behavior.

How It Works

The tool parses your code into an abstract syntax tree using the open-source terser engine for JavaScript and clean-css for CSS, then re-generates the most compact equivalent source from that tree: dropping comments and unnecessary whitespace, shortening numeric and color values where safe, and, for JavaScript with mangling enabled, renaming local-scope identifiers to the shortest available names. Because the transformation works on the parsed structure rather than raw text, the resulting code behaves identically to the original.

Problems it solves

Frequently asked questions

›Does this tool also format or beautify code?

No, this tool only minifies (shrinks) code by removing whitespace and comments. If you need readable, properly indented code instead, use a dedicated formatter tool.

›What does "mangle" mean for JavaScript?

Mangling renames local variables and function parameters to short names like "a" or "b" wherever it is safe to do so, which saves additional bytes beyond just removing whitespace. It never renames globally accessible names, so it does not break code that relies on specific global identifiers.

›Is minified code safe to use in production?

Yes, minification only changes whitespace, comments, and (optionally) local variable names. The logic and behavior of the code are preserved exactly, which is why minified JavaScript and CSS are standard practice on production websites.

›Why did minification fail with an error?

Minifiers need valid, parseable JavaScript or CSS. If your input has a syntax error, the minifier cannot build a correct internal representation of it. Check the code in a linter or browser console to find the exact issue, fix it, and try again.

›Should I keep an unminified copy of my code?

Yes. Always keep your original, readable source code as the version you edit and maintain, and generate the minified version as a build step. Treat minified output as a disposable artifact, not a file to hand-edit.

Related Tools