100% Free In-browser Instant minify

JS Minifier Free Online

Remove comments, collapse whitespace and compact JavaScript code instantly. Paste your JS or upload a .js file — all processing runs inside your browser, your code is never sent to a server.

Drop a .js file here or click to browse
Never uploaded · How it works

Minify JavaScript in 3 steps

1

Paste or upload

Paste your JavaScript into the input box, or drop a .js file directly onto the upload zone.

2

Auto-minify

The minifier runs instantly as you type, stripping comments and collapsing whitespace while preserving string literals.

3

Copy or download

Copy the minified JavaScript to your clipboard or download it as a .min.js file ready to deploy.

Frequently asked questions

JS minification removes all characters that are not required for the code to execute correctly. This includes single-line comments (// …), multi-line block comments (/* … */), and excess whitespace/newlines. String literals (single, double, and template quotes) are preserved exactly.

Our minifier is careful to preserve string contents and avoid breaking syntax. It does not rename variables or perform dead code elimination — it only removes whitespace and comments. For large or complex scripts always test the minified output before deploying to production.

No. All minification runs entirely inside your browser using JavaScript. Your code is never sent to any server and never leaves your device. This makes the tool safe even for proprietary or confidential source code.

Typical results range from 20–50% size reduction depending on how much whitespace and how many comments your script contains. Combined with gzip or Brotli compression on your server, total transfer savings can exceed 70%.

Yes. The minifier uses a state-machine tokenizer that recognises single-quote, double-quote, and template-literal (`…`) strings and skips them entirely during whitespace collapsing. Simple regular expression literals are also handled with care.

Everything you need to know about JavaScript Minification

JavaScript is one of the heaviest resources a web page loads. Every kilobyte of JS must be downloaded, parsed, compiled, and executed before the page becomes interactive. Minifying your JS reduces that overhead, leading to faster Time-to-Interactive (TTI) scores and better Core Web Vitals.

Why minify JavaScript?

Minified JS files load faster because they are smaller. Google's PageSpeed Insights and Lighthouse both flag un-minified JavaScript as an opportunity. Reducing JS payload also directly improves the Total Blocking Time (TBT) metric, which is part of Google's Core Web Vitals ranking signals.

What our JS minifier removes

Our minifier removes single-line comments (// …), block comments (/* … */), and all unnecessary whitespace and newlines. It is careful to skip string literals (single-quoted, double-quoted, and template literals) so that strings with spaces or comment-like content are not corrupted.

Minification vs. obfuscation vs. bundling

Minification only removes whitespace and comments. Obfuscation additionally renames variables and functions to short names, making reverse-engineering harder. Bundling (webpack, Rollup, Vite) combines multiple modules into fewer files. Our tool handles minification only — it is safe, predictable, and requires no build toolchain.

When to use this tool

Use this tool for quick one-off minification, small projects without a build system, or when you need to reduce the size of a third-party script you're self-hosting. For larger projects, consider integrating Terser or esbuild into your build pipeline for more aggressive optimizations like dead code elimination and variable renaming.