freetools.guru

JS Minifier

Minify JavaScript code for production instantly in your browser. Remove comments and unnecessary whitespace with semantics-safe token handling, keep /*! license banners, and copy or download the minified output. Private, no uploads.

Paste JavaScript to get started

Options

License banners such as /*! Copyright ... */ are kept by default so you stay compliant when shipping minified files.

How this minifier works

  • Removes comments and unnecessary whitespace while keeping your code functionally identical — operator boundaries such as a + +b are never merged into a++b.
  • Preserves line breaks where JavaScript's automatic semicolon insertion could change the meaning, so return on its own line stays a statement end.
  • Handles strings, template literals, regex literals, BigInt and Unicode (Tamil, Hindi, emoji and more) without touching their contents.
  • Keeps /*! ... */ license banners when the option is enabled.

Minification is not obfuscation and not encryption. It reduces file size by removing comments and whitespace; anyone can still read and reverse the output. Always keep your original source file — minified code is difficult to edit by hand.

Your code is minified locally in your browser and is never uploaded.

How it works

  1. 1Paste your JavaScript. Paste any script — ES modules, classes, async/await, template literals, regex literals or Unicode text — into the input. Up to 2,000,000 characters are supported.
  2. 2Minify. Click Minify JS (or press Ctrl+Enter). Comments and unnecessary whitespace are removed with semantics-safe token handling: operators never merge, ASI line breaks are preserved, and strings, templates, regexes and BigInt literals are never touched.
  3. 3Check the savings. Review the statistics — original size, minified size, percentage saved and comments removed. Toggle Preserve license comments to keep or drop /*! banners.
  4. 4Copy or download. Copy the minified output, download it as minified.js, or move the result back into the input for another pass — all locally in your browser.

Best practices

  • Keep your original source file — minified code is hard to edit by hand, so the readable version is your source of truth.
  • Enable Preserve license comments for files that ship with open-source licenses or copyright notices, then always double-check the banner survives in the output.
  • Minification removes comments and whitespace but never renames variables; if you need deeper optimization, run the output through a full parser-based minifier such as Terser.
  • Minification is not obfuscation — never put secrets, API keys or passwords in client-side code that can be minified and read by anyone.
  • Everything runs locally in your browser — nothing is uploaded.

Frequently Asked Questions

What does the JS Minifier do?
It shrinks JavaScript by removing comments and unnecessary whitespace so the file loads faster. Your code runs locally in the browser: paste your script, click Minify JS, and copy or download the minified output — nothing is uploaded.
Does minification change how my code works?
No — this minifier is semantics-safe by design. It only removes comments and whitespace that are never needed. Operator boundaries such as a + +b are never merged into a++b, and line breaks are preserved wherever JavaScript's automatic semicolon insertion could change the meaning (for example after return). String, template, regex and BigInt contents are never touched.
Is minification the same as obfuscation?
No. Minification removes comments and whitespace to reduce size; the code structure stays readable to anyone who inspects it. Obfuscation deliberately makes code hard to understand and usually renames variables and transforms logic. This tool minifies — it does not obfuscate, and minification should never be used to hide secrets.
Does the JS Minifier rename variables?
No. Variable renaming and deep optimizations such as dead-code elimination require a full JavaScript parser (tools like Terser do this). This tool focuses on safely removing comments and unnecessary whitespace, which already gives a large size reduction for most scripts.
Are comments removed?
Yes — line (//) and block (/* */) comments are removed. License banners that start with /*! are kept by default so you stay compliant when shipping minified files; you can turn this off with the Preserve license comments option.
Can it minify modern JavaScript?
Yes. The minifier handles ES modules, classes, private fields (#x), optional chaining (a?.b), nullish coalescing (??), template literals with nested expressions, regex literals, BigInt literals, arrow functions, async/await, and Unicode identifiers and strings including Tamil, Hindi, Arabic, CJK and emoji.
What happens if my JavaScript has a syntax error?
The tool reports a clear error instead of producing broken output. For example, an unterminated string, template literal, regular expression or block comment is flagged with a message and its line and column so you can fix the source.
Is minification a security measure?
No. Minified code can still be read and reverse-engineered, and anyone can un-minify it. Never rely on minification to hide credentials or sensitive logic — that is what encryption and proper access control are for.
Is my code uploaded?
No. All minification happens locally in your browser — your code never leaves your device, no account is required, and nothing is stored or shared. The output is a plain text file you can copy or download.

Related Tools

Supported JavaScript

Minify any modern JavaScript directly in your browser: ES modules, classes with private fields, arrow functions, async/await, generators, optional chaining, nullish coalescing, destructuring, spread, template literals with nested expressions, regex literals, BigInt literals and numeric separators. Strings, template and regex contents, and Unicode text (Tamil, Hindi, Arabic, CJK and emoji) are preserved exactly. Regular-expression detection follows real engines, so patterns like if (x) /re/.test(y) and division stay correct. Up to 2,000,000 characters per input. Everything runs locally — no uploads.

Privacy & data removal

Your JavaScript is minified entirely in your browser and is never uploaded to any server. No account is required to use the JS Minifier, we never store or share your code, and the minified output stays on your device until you copy or download it.