All tools

JS Minifier

Code

Minify JavaScript by removing comments, collapsing whitespace, and stripping console calls

Paste JavaScript to strip comments, collapse whitespace, and remove `console.log`/`warn`/`error` calls before shipping a quick script, with before/after byte counts to see the savings. The comment stripper tracks string and template-literal state character by character so it won't accidentally strip a `//` or `/* */` that appears inside an actual string, but the console-call remover is a simpler single-line regex pattern that can break on a call containing nested parentheses. This is surface-level minification only: there's no real variable-name mangling or dead-code elimination like a tool such as Terser or esbuild would do, and the option to enable mangling exists in the interface but isn't actually implemented. For a real production build, reach for a proper bundler and minifier rather than this tool, which is meant for a one-off script rather than a build pipeline.

jsjavascriptminifycompressuglify

How to use JS Minifier

  • 1.Paste JavaScript source to strip comments, collapse whitespace, and remove `console.log` calls before shipping to production.
  • 2.Use it to quickly shrink a small script or snippet without setting up a full bundler pipeline like esbuild or Terser.
  • 3.Compare the minified byte size against the original to estimate the payload savings for a script tag.

Frequently asked questions

Does this do full variable name mangling like Terser?
No — this performs safe surface-level minification (whitespace, comments, console stripping) rather than aggressive variable renaming or dead-code elimination, so it's lighter-weight but produces less compact output than a full bundler-based minifier.
Will removing console.log calls break my code?
It only strips the `console.*` call statements themselves, not surrounding logic, so it's safe for typical debug logging — but be cautious if you rely on a console call's side effects (rare, but possible with certain polyfills).
Is my code sent to a server?
No, minification happens entirely in your browser.
Should I use this for a production build pipeline?
For one-off scripts or quick shrinking it's fine, but for a real production build you should use a proper bundler (esbuild, Terser, Rollup) that also handles tree-shaking, source maps, and syntax-aware mangling.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/js-minify \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"input": "function greet(name) { return \"Hello, \" + name; }"}'

Get an API key from your dashboard · Full API docs →