Conservative and predictable
Only comments and whitespace that cannot change behaviour are removed. Variable names, function names and string contents are untouched, so the output is easy to reason about.
Remove comments and whitespace from JS without renaming identifiers — a JavaScript minifier that keeps your names.
Loading tool…
The tool is loading its code on your device. This happens once and is cached for later visits.
Processed entirely on your device
Overview
Minify JavaScript online with a conservative pass that strips comments and insignificant whitespace without renaming identifiers or altering behaviour. In-browser, no upload.
There are two things people call JavaScript minification, and it is worth being clear about which one this JavaScript minifier does. A full minifier parses your code into an abstract syntax tree, renames every local variable to a single letter, folds constants, drops unreachable branches and re-emits the smallest equivalent program. This tool does the safe half of that job: it removes comments and whitespace that cannot change what the code does, and leaves everything else exactly as you wrote it.
To minify JavaScript here is to compress it without mangling it — a JS minifier that never renames identifiers, never rewrites expressions and never touches the contents of strings, template literals or regular expressions. That makes the output predictable, greppable and safe to paste anywhere the original would have been safe.
Renaming identifiers is powerful but fragile. It breaks code that reads function.name, that relies on a variable name matching a string used in reflection or dependency injection, or that shares a global with another separately minified file. A whitespace-only pass has none of those failure modes. The output is still recognisable, still debuggable and still greppable, which is exactly what you want for a snippet you are about to paste somewhere and forget.
The kept column is the hard part. A regular expression such as one matching a space, or a template literal spanning several lines, contains whitespace that is data rather than formatting. Stripping it would silently change behaviour, so the pass tracks those contexts and leaves them alone.
JavaScript infers semicolons from newlines in a few situations. Joining two lines carelessly can move where a statement ends and change the program. This is the classic reason a find-and-replace on newlines is not a minifier. A correct pass knows where a line break is load-bearing and keeps it, which is why the reduction is smaller than a real compiler achieves but the result is trustworthy.
For an application, use Terser, esbuild or SWC in your build. They produce source maps so minified stack traces still point at your original lines, and their renaming and tree-shaking cut far more than whitespace removal can. Use this tool for the small jobs: compressing an inline script, shrinking a bookmarklet, or checking how much of a file is just formatting.
A readable, commented script usually shrinks by 20 to 40 percent with whitespace and comment removal alone. Full minifiers that also rename identifiers and drop dead code reach 50 to 70 percent, which is why production bundles go through Terser or esbuild. The gap is the price of conservatism — and for a single script, a snippet or a bookmarklet, it is a price worth paying to keep output you can still read.
Plenty of code ends up in places that punish every newline: inline event handlers, CMS script fields, bookmarklets with a length ceiling, chat messages, config-driven loaders. Those are exactly the places where a mangled, single-letter-variable bundle is a liability — you cannot debug what you cannot read. A minified-but-recognisable script compresses the formatting and keeps the meaning, so the pasted version still maps one-to-one onto the source in your editor.
Source maps exist precisely because full minification destroys readability: they translate a minified stack trace back to the original lines, and every serious bundler emits them. A whitespace-and-comment pass barely needs them — the lines are the same lines, and the identifiers are the same identifiers — which is a quiet advantage when you are debugging something pasted into a console or an error reporter with no map support. If your toolchain emits maps, keep them; if you are using this tool, you will rarely miss them.
No renaming means no failure modes: no broken function.name reflection, no dependency injection by string matching, no globals that stop matching across separately loaded files. Combined with the fact that everything runs locally — your proprietary or unreleased scripts never touch a server — this is the JS minifier for the jobs between "paste it as-is" and "wire up a bundler". Paste, minify, check the byte counts, copy or download.
The fastest way to trust a conservative minifier is to feed it code you know by heart. Watch the comments vanish, the indentation flatten and every identifier survive — then check the byte counter. What you see is the entire transformation: nothing hidden, nothing rewritten, just the whitespace gone.
Step by step
Paste your JavaScript into the input panel.
Press Minify JavaScript; comments and insignificant whitespace are removed.
Review the output — identifiers and logic are left exactly as written.
Copy the result or download it as a .js file.
Why use it
What this tool is good for, and what it deliberately does not try to do.
Only comments and whitespace that cannot change behaviour are removed. Variable names, function names and string contents are untouched, so the output is easy to reason about.
Because it never mangles identifiers, it cannot break code that relies on function.name, reflection, or names referenced across separately loaded files.
Whitespace inside string literals, template literals and regular expressions is preserved, which is where a naive whitespace-stripping pass corrupts code.
Proprietary or unreleased scripts are never sent to a server — the whole pass happens in the browser.
Questions
Short, honest answers about quality, limits and privacy.