CSS and JavaScript Minifier
- Original
- –
- gzip –
- Minified
- –
- gzip –
- Saved
- –
- gzip –
Minifying removes everything a browser does not need from a stylesheet or script: comments, spaces, line breaks and long names. The code behaves the same but is smaller, so pages load faster. This tool minifies CSS and JavaScript in one place and shows the size before and after, the percentage saved and the gzip size, which is closer to what visitors actually download.
JavaScript is minified with Terser and CSS with CSSO. You can turn compression and name mangling on or off, keep license comments, and treat the code as an ES module. To read code that someone else minified, switch to Beautify and choose the indentation. Everything runs in your browser in a background worker, so large files do not freeze the page and nothing is uploaded.
Choose CSS or JavaScript, make sure Minify is selected, then paste your code or upload a file. The minified result appears as you type, with the size saved. Copy it or download it as a .min.css or .min.js file.
Compress rewrites code into shorter forms and removes dead code. Mangle names shortens local variable and function names. Mangle top-level names also shortens names declared at the top of the file, which is only safe when other scripts do not use them. ES module treats the code as a module, which allows import and export.
Select Beautify to add line breaks and indentation to minified CSS or JavaScript. Pick 2 spaces, 4 spaces or a tab. Beautifying cannot bring back original variable names or comments that were removed.
Most servers send text files compressed with gzip. The gzip size is how large your code is after that compression, which is closer to what visitors download than the raw size. The tool shows it for the original and for the result.
The code has a syntax problem, such as a missing bracket or a stray character. The tool shows the line and column of the first problem and a Go to error button that selects it. Fix it and the result appears.
JavaScript is minified with Terser and CSS with CSSO. Beautifying uses js-beautify. All three are open source and are served from this site.
No. The work runs in your browser, in a background worker, and nothing leaves your device.