Database & Code

Code Minifier

Minify JavaScript and CSS to reduce file size for production — paste your code and get compact output with unnecessary whitespace, comments and formatting removed.

Open Code Minifier →
Looks like you're using an ad blocker. Devbin is free — ads help keep it running.

What Minification Removes

Whitespace — indentation, blank lines, extra spaces between tokens. Comments — single-line (//) and multi-line (/* */) comments. Newlines — collapses multi-line code to fewer lines. Optional semicolons (JS) — where safe to omit. Redundant syntax — unnecessary brackets, quotes style normalisation.

How to Use It

1

Open the tool

Go to Database & Code and scroll to the Code Minifier.

2

Select language

Choose JavaScript or CSS to set the appropriate minification rules.

3

Paste your code

Paste the formatted source code into the input panel.

4

Copy minified output

Copy the minified output and deploy it, or include it in your build pipeline.

Pro Tips

💡Combine minification with server-side gzip/brotli compression — the two complement each other and together significantly reduce transfer size.
💡Keep source maps (// sourceMappingURL=app.min.js.map) in production to enable readable stack traces in browser DevTools despite serving minified code.
💡Modern build tools (Vite, webpack, esbuild, Parcel) minify automatically in production builds. This tool is useful for quick manual minification without a build pipeline.

Frequently Asked Questions

What does minification do?
Removes whitespace, comments and unnecessary characters to reduce file size. Smaller files transfer faster and parse more quickly in the browser.
Does it change behavior?
Correct minification should not change behavior. Aggressive variable renaming can break code using eval() or relying on global variable names — test after minifying.
Should I commit minified code?
No — commit source code, generate minified output in the build pipeline. Minified files go in dist/ or build/ which should be gitignored.
Minification vs compression?
Minification removes characters from source. Compression (gzip/brotli) is applied at transfer time by the server. Both reduce bytes — use both for maximum effect.

Minify your code now

Open the Code Minifier and compress JavaScript or CSS for production — free, instant, no login.

Open Code Minifier →