JS Minifier

Minify JavaScript by removing comments, whitespace, and newlines. Supports console.* removal and variable name mangling.

Input data is processed in your browser
Data is never sent to a server

Tool

0 chars

or drag & drop a file

What is the JS Minifier?

This tool reduces the size of JavaScript files by removing comments, whitespace, and newlines, with optional extras like console statement removal and variable name mangling.

It runs entirely in the browser with no installation needed. It is ideal for quick size checks on simple scripts. For production use, a full-featured tool like terser is recommended.

How to Use

  1. Paste your JavaScript into the input field and click "Minify". Click "Sample" to see an example.
  2. Enable "Remove comments" to strip line comments (//) and block comments (/* */).
  3. Enable "Remove console.*" to delete all `console.log`, `console.warn`, and similar debugging calls entirely.
  4. Enable "Collapse strings" to convert template literals without expressions into regular strings.
  5. Enable "Mangle local variable names" to shorten `let`/`const`/`var` variable names to a, b, c...
  6. The character count and savings percentage are shown after minification. Click "Download" to save the result as `.min.js`.

FAQ

How does this compare to terser or UglifyJS?

terser and UglifyJS are full AST-based minifiers. This tool is a lightweight, browser-based pure TypeScript implementation with no installation required. It is well-suited for quick minification of simple scripts or learning purposes. For production bundles, use a dedicated tool like terser.

Does it support TypeScript or JSX?

No. TypeScript type annotations and JSX syntax are not supported. The tool targets plain JavaScript (ES2015+).

What does the variable mangling option affect?

It shortens the names of variables declared with let, const, or var to a, b, c, and so on. Object property names and exported variable names are not renamed.

Is my code sent to a server?

No. All processing happens entirely in the browser.