JavaScript Minifier

Minify JavaScript by stripping comments and whitespace — no upload

Ad placeholder (leaderboard)

A JavaScript minifier reduces file size by removing everything a browser does not need to run your code: comments, indentation, and blank lines. Smaller files download faster and parse quicker, which improves page-load performance. This tool minifies your JavaScript in the browser and shows exactly how many bytes you saved, with no upload.

How it works

The minifier scans your source one character at a time, acting like a small tokenizer. When it encounters a string, template literal, or regular-expression literal, it copies the entire literal verbatim — quotes, escapes, and all — so nothing inside is altered. The trickiest case is the / character, which can start either a division or a regex; the tool decides based on the previous significant token (for example, a / after return or ( begins a regex), exactly as a JavaScript parser would.

Outside of literals, line comments (//) and block comments (/* */) are dropped entirely. Runs of whitespace are then collapsed: a single space is preserved only when it sits between two identifier characters, such as in return value where removing the space would merge two tokens. Everywhere else the whitespace is removed.

What it does not do

Unlike Terser or UglifyJS, this tool does not rename identifiers, fold constants, or eliminate dead code, because those transformations require a full AST and can subtly change behaviour. The trade-off is safety and readability: the output behaves identically to your input. For maximum compression in production, pair this with gzip or Brotli, which together typically beat aggressive renaming on real-world code. Everything runs locally in your browser.

Ad placeholder (rectangle)