I Help You

JS Minifier

Minify JavaScript code quickly. Free, and it runs entirely in your browser — nothing you enter is uploaded.

How to use the JS Minifier

1. Paste your JavaScript source code into the Input panel on the left.

2. Click Minify JS — whitespace, comments, and unnecessary formatting are removed.

3. Copy the output and deploy it in your production HTML file, CDN, or bundler configuration.

4. Always keep your original unminified source for development and debugging. Use source maps in production to maintain stack trace readability.

What is it?

JavaScript minification removes all whitespace, comments, and superfluous formatting characters that the JavaScript engine does not need to execute the code. This produces a compact single-line (or few-line) version of your script that is functionally identical to the original.

JavaScript is a parser-blocking resource on the main thread. Smaller scripts download faster over the network and parse more quickly in the browser engine, both of which contribute to faster page interactivity (Time to Interactive, or TTI). For scripts served without a CDN or HTTP/2 push, even small reductions in payload size translate to measurable improvements on slower connections.

This tool uses js-beautify in compact mode. For advanced minification including dead-code elimination, scope-aware variable renaming, and tree-shaking, consider Terser or esbuild in your production build pipeline — those techniques require full static analysis and go beyond what a browser-side tool can safely do.

Example

Formatted JavaScript
function greet(name) {
  const message = "Hello, " + name + "!";
  return message;
}
↓
Minified JavaScript
function greet(name){const message="Hello, "+name+"!";return message;}

Benefits

Ship smaller JavaScript bundles

Removing whitespace, comments, and unused characters reduces download size and parse time for every user who loads your page.

Quick minification without build tooling

Minify a single script without configuring webpack, rollup, or esbuild — paste and get the output immediately.

Faster parse and execution time

Smaller JavaScript files parse and execute faster in V8, SpiderMonkey, and JavaScriptCore — measurable on mobile devices.

Audit legacy scripts before refactoring

Minify an old script and see its compressed form to assess complexity and duplication before a modernisation project.

Frequently asked questions

What's the difference between minification and obfuscation?

Minification removes whitespace and comments for a smaller file. Obfuscation additionally renames variables and functions to meaningless characters, making the code intentionally hard to read. This tool does minification only. True obfuscation requires a dedicated tool like javascript-obfuscator.

Can minified JavaScript be reversed?

It can be partially reversed using a JS beautifier or 'prettifier', which restores whitespace and formatting. However, original variable and function names cannot be recovered unless source maps were included.

Should I minify node_modules dependencies?

Most npm packages already ship with pre-minified production builds (usually in a /dist or /min folder). You only need to minify your own application code. Build tools like Vite, webpack, and Rollup handle this automatically.

Is my code transmitted to any server?

No. Minification runs entirely in your browser. Your JavaScript source code is never uploaded or stored anywhere.