JS Minifier

Shrink JavaScript by removing comments and unnecessary whitespace — string- and regex-aware, so your code keeps working. Runs in your browser.

100% free, no sign-up Runs in your browser — nothing uploaded Instant, works offline

This JavaScript minifier shrinks your code by removing comments and unnecessary whitespace — indentation, blank lines and the spaces between tokens — while carefully skipping over strings, template literals and regular expressions so it never changes what your code does. It keeps line breaks where they matter, so automatic semicolon insertion is not affected. Paste your JS and press Minify. Everything runs in your browser, so nothing is uploaded. For a full build-step minifier with variable renaming, use a tool like Terser in your pipeline; this is the quick, safe option for a snippet.

Frequently Asked Questions

Is it safe to minify my JavaScript here?

Yes. The minifier is string-, template- and regex-aware, meaning it recognises those constructs and never edits their contents — so a comment marker inside a string, or a slash inside a regular expression, is left alone. It removes comments and collapses whitespace but preserves the line breaks that JavaScript’s automatic semicolon insertion relies on, so your code keeps behaving the same.

Does it rename variables like a full minifier?

No. This tool does the safe part of minification — stripping comments and whitespace — without renaming variables or rewriting expressions, which keeps it completely reliable for any snippet. Aggressive minifiers like Terser or esbuild also shorten variable names and remove dead code for a smaller result, but they run as a build step; this tool is for quickly shrinking a piece of code in the browser.

Is my code uploaded anywhere?

No. Everything runs locally in your browser using built-in JavaScript — your code is never sent to a server, logged or stored. There is no account and no sign-up, and it works offline once the page has loaded.