ToolBark
Developer

JavaScript Minifier

Shrink your JavaScript instantly — strip comments, collapse whitespace.

Original340 B
Minified169 B
Saved50%

This is a lightweight minifier — it removes comments and collapses whitespace. For production builds, use a dedicated bundler like esbuild or Terser.

About

A free online JavaScript minifier that removes single-line and block comments, then collapses all unnecessary whitespace to produce a compact, browser-ready script. Paste any JavaScript snippet and get the minified version in real time — no installs, no build tools needed. Ideal for quick size checks, code sharing, or learning how minification works before integrating a full bundler.

FAQ
What does this JavaScript minifier do?+

It removes single-line (//) and block (/* */) comments, then collapses sequences of whitespace and newlines into a single space, producing a smaller but functionally equivalent script.

Is it safe for production code?+

This is a lightweight, regex-based minifier suitable for simple scripts. For production builds with complex code, template literals, or regex literals, use a dedicated tool like esbuild, Terser, or UglifyJS.

Does it change the logic of my code?+

No — it only removes whitespace and comments, which have no effect on how JavaScript executes. Variable names and string contents are left completely unchanged.

How much file size reduction can I expect?+

For typical commented, well-formatted code you can expect 20–50% reduction. Heavily commented files may shrink even more. The stats panel shows exact original and minified byte counts after processing.

Related tools