JavaScript Minifier

Minify JavaScript code — removes whitespace and comments, shows byte savings

The JavaScript minifier compresses JS code by removing comments and unnecessary whitespace without renaming variables. Safe, predictable minification — the output runs identically to the original.

Minified JS will appear here...

How JavaScript Minification Works

This tool performs safe whitespace and comment removal. It does not rename variables or functions, which keeps the output easy to debug and eliminates the risk of variable mangling bugs. For full minification with tree-shaking, use Terser in your build pipeline.

What Gets Removed

Single-line comments (// comment), multi-line comments (/* comment */), leading/trailing whitespace, and excess blank lines. String contents are preserved — comments inside strings are NOT removed.

Frequently Asked Questions

Is this JavaScript minifier free?

Yes, completely free with no signup. All minification runs locally in your browser.

Does this rename variables?

No. This tool performs safe whitespace/comment removal only — it does not rename variables, mangle function names, or do code transformation. For full minification with variable mangling, use Terser or UglifyJS in your build pipeline.

Is it safe to minify production JavaScript?

Yes, whitespace removal is safe and reversible. Always keep your original source in version control. For debugging minified code in production, generate source maps using a build tool.

What types of comments are removed?

Both single-line comments (// comment) and multi-line comments (/* comment */) are removed. String contents are preserved — comments inside strings are not removed.

Can I download the minified output?

Yes. Click the Download button to save the minified JavaScript as a .min.js file, ready to use directly in your project.