A free browser-based JavaScript minifier that removes comments, compresses whitespace, and produces a single-line output instantly—100% client-side, no uploads.

JavaScript Minifier is a free, browser-based tool that reduces the size of your JavaScript files by removing comments, collapsing whitespace, and optionally joining all lines into a single-line output. No uploads, no server round-trips, no account required.
Every web project reaches a point where raw JS files need to go through a minifier. Locally that means installing Node.js tools, wiring up a build pipeline, and waiting for CI. For quick one-off tasks — cleaning up a legacy script, preparing a snippet to paste into a CMS, or stripping a vendor file of its verbose comments — that overhead is a speed bump developers don't need.
Browser-based minifiers solve this, but most of them upload your code to a server. For internal scripts, unreleased code, or anything business-sensitive, that is a non-starter.
JavaScript Minifier processes code entirely in the browser using a tokenizer-aware parser. It correctly handles single-quoted strings, double-quoted strings, and template literals, so it never misidentifies // inside a string as a comment, and never strips the content of a tagged template expression.
Strips both single-line (// ...) and block (/* ... */) comments. The parser tracks string boundaries, so content like const url = "https://example.com" is preserved intact.
Collapses runs of spaces and tabs to a single space, trims leading and trailing whitespace from every line, and removes blank lines. The result is readable but compact — useful when you want smaller output that is still debuggable.
Removes all newline characters to produce a one-liner. Combine this with the other two options for maximum compression of simple scripts.
The core minifier is a single-pass tokenizer implemented in TypeScript. It walks the input character by character, tracking the current context:
"'${} expressions// outside a string → single-line comment, skip to end of line (if option enabled)/* outside a string → block comment, skip to */ (if option enabled)A post-pass trims each line and removes blank lines when compress mode is active.
This approach is O(n) in input length, deterministic, and requires no AST — making it suitable for real-time processing of large files without blocking the UI.
Many CMSes (WordPress, Webflow, Squarespace) have a "custom code" box. Pasting 400 lines of commented JS into that box wastes space and looks messy. Run it through the minifier in 10 seconds and paste a compact, clean version.
Open-source libraries often ship unminified source in their dist/ folder alongside the minified version. If you only have the unminified version, use the minifier to strip the comments before embedding.
Removing comments first, then reading the minified output, is a fast way to understand what a script actually does without getting distracted by documentation comments and version headers.
Inline <script> tags in HTML should be kept small. Minifying a short utility function before inlining it reduces the initial HTML payload.
Before wiring up a full webpack or esbuild pipeline, use the minifier to verify that a script minifies correctly. If the output runs as expected in the browser console, the script is minification-safe.
For a typical developer-formatted JavaScript file:
Try it now: javascript-minifier.tools.jagodana.com
The client needed a robust developer tools solution that could scale with their growing user base while maintaining a seamless user experience across all devices.
We built a modern application using JavaScript and Minifier, focusing on performance, accessibility, and a delightful user experience.
Category
Developer Tools
Technologies
Date
June 2026
More work in Developer Tools