Code minifier
Paste your code, choose the language, and get the minified version with the exact savings, including the gzip size. It also beautifies minified code.
Options
Your code is processed on this device: it is not sent to any server.
Processing…
The code has an error
Always check the result before publishing it. Minifying does not change what the code does, but shortening names can break anything that uses eval or calls functions by their name as text.
How to use it
- Paste your code into the input, drag in a file, or select “Example”. The language is detected from the file extension or the content, and you can change it by hand.
- Choose “Minify” to reduce the size or “Beautify” to give minified code a readable format, with 2 spaces, 4 spaces, or a tab.
- Adjust the options: remove comments (those starting with /*! are kept), shorten names, remove console.log, or collapse whitespace in HTML.
- Check the savings and the gzip size. If there is a syntax error, you get the line and column with an explanation; select “Go to error” to jump straight to it.
- Copy the result or download it with the right name, for example .min.js or .min.css. Always test the minified code before publishing it.
Frequently asked questions
Is my code uploaded to a server?
No. Everything is processed in your browser with open-source libraries (Terser, CSSO, html-minifier-terser, and SVGO) that are downloaded only when you choose that language. You can paste private code with confidence.
How much smaller does it get?
It depends on the code. JavaScript with comments and long names usually shrinks by 40% to 70%; CSS with whitespace and redundant values, by 20% to 40%. Besides the bytes, we show the gzip size, which is what the server actually sends.
Can minifying break my code?
Removing whitespace and comments does not change behavior. Shortening names and aggressive compression can break code that uses eval, new Function, with, or calls global functions by name from other scripts. If something fails, turn those options off and compare.
Are licenses and important comments preserved?
Yes. In JavaScript and CSS, comments that start with /*! are kept when you remove comments (in JavaScript, so are those that include @license or @preserve), so you do not lose the license notices of the libraries you use.
What happens to large numbers in JSON?
They are kept exactly as they are. Many minifiers read JSON as a JavaScript object and turn 12345678901234567890 into 12345678901234567000. Here every number keeps its original digits.
Can I read minified code again?
Yes. Switch to “Beautify” to get indentation and line breaks back. Names shortened by a minifier cannot be restored, because that information is lost when minifying.
What a minifier does
A minifier removes everything the browser does not need to run your code: spaces, line breaks, comments, and, in JavaScript, long names of local variables. The resulting file does the same thing, but it is smaller and downloads sooner. On a page with a lot of code, you can notice it in the loading speed.
What is applied to each language
- JavaScript: removes dead code, simplifies expressions, and shortens local names with Terser.
- CSS: reduces colors (
#ffffffbecomes#fff) and repeated values (0pxbecomes0), and merges identical rules with CSSO. - HTML: collapses whitespace, removes comments, and drops quotes from attributes that do not need them.
- JSON: removes the extra whitespace without touching the values or the order of the keys.
- SVG: cleans up metadata, rounds coordinates, and simplifies paths with SVGO.
Good practices before publishing
Always keep the original file: the minified one is not meant to be edited. Test the result on your page, especially if you turned on “Shorten variable and function names” or aggressive compression. If you use a bundler such as Vite, esbuild, or webpack, it already minifies for you when you build; this tool is for loose files, snippets, and quick checks.
Updated on September 30, 2026