Minify JavaScript and CSS
Minify JS / CSS
What is Code Minifier?
Minify JavaScript using Terser (full ESNext support, mangle + compress) or CSS via a lightweight regex-based minifier. Useful for producing a single-file drop-in version of a snippet, fitting code into a size-limited embed, or generating a dist build for a small demo. JS mode shows the size saved as a percentage.
How do I use Code Minifier?
- Paste JS or CSS into the input panel.
- Pick JS or CSS mode.
- For JS, toggle mangle names and preserve license comments.
- Copy or download the minified output.
When should I use Code Minifier?
Code Minify is for size reduction. To format for readability (the opposite), use Code Beautify. For production builds, rely on your bundler's minifier rather than hand-minifying; this tool is best for one-off snippets.
Frequently asked questions
Which languages can it minify?
JavaScript, CSS, and HTML. JS is minified with Terser; CSS with clean-css; HTML with html-minifier-terser.
Does it mangle variable names?
For JavaScript, yes; short names reduce size significantly. Toggle off if you need readable stack traces for debugging.
Should I minify for production?
Only if your build pipeline does not already. Most bundlers (Webpack, Vite, esbuild) already minify; use this tool for one-off snippets, bookmarklets, or pasting into CDN hosts that do not.
Is my file uploaded anywhere?
No. Everything runs in your browser. Your files never leave your device, and there is no server component for this tool.
Tools that pair well with Code Minifier
- Code Beautifier js, python, sql formatter, free and in your browser.
- JSON Minifier strip whitespace from json, free and in your browser.
- SQL Formatter pretty-print sql, free and in your browser.
- JSON Formatter format & validate json, free and in your browser.