JS & CSS Minifier

Shrink JavaScript and CSS files safely, or make minified code readable again. You see the real size before and after, including gzip, and your code never leaves the browser. Speeding up a whole site? Add a sitemap next.

Mode
Language
Options
Keep license comments/*! ... */ and @licenseON
CSS: shorten colours#ffffff to #fffON
CSS: remove empty rules.unused { }ON

Your code

Result

Ctrl + Enter run

How to Minify JavaScript and CSS

  1. Add your code. Paste JavaScript or CSS into the input box, or drop one or more .js and .css files on it.
  2. Choose minify or beautify. Minify shrinks the code; beautify makes minified code readable again. The language is detected for you.
  3. Check the result. See the size before and after, the gzip size and the syntax check, right above the output.
  4. Copy or download. Copy the result or download it as name.min.js or name.min.css. Several files come as one ZIP.

Keep your original, readable files for editing, and upload only the .min versions to your site.

What This Minifier Does - and Does Not Do

We would rather be honest than squeeze out the last byte.

ChangeJavaScriptCSS
Remove commentsYes (license kept)Yes (license kept)
Remove spaces and indentationYesYes
Remove line breaksWhere safe - breaks that act as semicolons stayYes
Shorten valuesNo#ffffff to #fff, 0.5 to .5
Rename variables (mangling)No-
Rewrite or remove codeNoOnly empty rules

Because nothing is renamed, errors in the browser console still show your own function names - handy while debugging.

Why File Size Matters

Faster pages

Smaller scripts and styles download and parse sooner, which helps Core Web Vitals and search rankings.

gzip matters too

Servers compress text before sending it. We show the gzip size so you see the real saving on the wire.

Less data

Visitors on mobile data load your site with fewer bytes.

Images are usually the biggest files on a page. Compress them with the PNG compressor or turn them into WebP.

More Tools for Site Owners

See everything in Webmaster Tools.

Frequently Asked Questions

It removes what browsers do not need - comments, indentation, line breaks and extra spaces - so the file downloads faster. The code works exactly the same.

The tool shows the real size before and after, plus the gzip size your server actually sends.

No. Minifying and beautifying happen in your browser, so your code never leaves your device. The old version of this page sent code to our server - that is gone.

The JavaScript minifier reads your code token by token, so strings, template literals and regular expressions are never touched. Line breaks that JavaScript needs for automatic semicolons are kept.

After minifying, the browser parses the result as a syntax check. We also tested it on large libraries such as D3, KaTeX and pdf-lib, where the output parses to exactly the same program.

Those tools also rename variables (mangling) and rewrite code. This minifier only removes comments and whitespace, which is safer and easier to debug, but typically saves 30-50% instead of 50-70%.

For the smallest production bundles, use a build tool with Terser. For a quick, safe shrink of a script or stylesheet, this is ideal.

It removes comments and spaces, drops the last semicolon in each rule, shortens colours like #ffffff to #fff and 0.5 to .5, and removes empty rules. Spaces that matter, such as in calc() or between selectors, are kept. Custom properties (--variables) are left exactly as written.

Beautify does the opposite: it lays minified code out on separate lines with indentation, so you can read it. Pick 2 spaces, 4 spaces or tabs. It is a quick reformatter, not a full code-style tool like Prettier.

Yes. Drop up to 50 .js and .css files on the input box. Click any file to preview it, and download them all as a ZIP. Each file keeps its name with .min added.

Yes, by default. Comments that start with /*! or contain @license or @preserve stay at the top of the file, as most open-source licenses require. Switch off Keep license comments to remove them too.

Guides & Tutorials

All 42 guides
New Tutorial How to Use Twitter (X) GIFs on Discord Nov 4, 2026 · 4 min read Read New Guide How Do QR Codes Work? Anatomy, Error Correction and History Nov 4, 2026 · 11 min read Read New Guide Barcode Types Explained: EAN, UPC, Code 128, ISBN and More Oct 28, 2026 · 8 min read Read