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.
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 + +bare never merged intoa++b. - Preserves line breaks where JavaScript's automatic semicolon insertion could change the meaning, so
returnon 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
- 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.
- 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.
- 3Check the savings. Review the statistics — original size, minified size, percentage saved and comments removed. Toggle Preserve license comments to keep or drop /*! banners.
- 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?
Does minification change how my code works?
Is minification the same as obfuscation?
Does the JS Minifier rename variables?
Are comments removed?
Can it minify modern JavaScript?
What happens if my JavaScript has a syntax error?
Is minification a security measure?
Is my code uploaded?
Related Tools
Format and beautify HTML code.
Format, validate, and beautify JSON data.
Test and debug regular expressions in real time.
Format and clean plain text with presets for spacing, line endings, sorting and lists.
Encode and decode Base64 strings instantly.
Minify CSS code to reduce file size.
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.
