Free Online JavaScript Minifier

Remove comments, extra whitespace, and newlines from your JavaScript to reduce file size.

About JavaScript Minifier

JavaScript minification removes comments, unnecessary whitespace, and newlines from your code to reduce file size. Smaller files load faster, improving page speed and user experience. This is a basic minifier that handles common patterns; for production builds with advanced optimizations like variable renaming and dead code elimination, use tools like Terser or esbuild.

How to Use

What This Minifier Does

The minifier removes single-line comments (//), multi-line comments (/* */), extra whitespace and newlines, while preserving strings, regular expressions, and necessary whitespace between identifiers. It does not rename variables or perform advanced optimizations.

Related Tools

Frequently Asked Questions

Does this minifier rename variables?
No. This is a basic minifier that removes comments and whitespace only. For advanced optimizations like variable renaming and tree-shaking, use production tools like Terser, UglifyJS, or esbuild.
Will minification break my code?
Basic minification that only removes comments and whitespace should not break your code. However, always test minified code before deploying to production.
Does this handle template literals?
Yes, the minifier recognizes backtick template literals and preserves their contents, including embedded expressions.
How much smaller does JavaScript get?
Basic minification typically reduces JavaScript file size by 15-35%, depending on how many comments and how much formatting is in the original code.
Is my code stored anywhere?
No. All minification happens in your browser using JavaScript. No code is sent to any server.