JavaScript Minifier
Minify JavaScript code for production.
How to Use JavaScript Minifier
Paste your JavaScript into the input area, or load a bundled .js file from your build output.
Choose between safe whitespace minification and aggressive mode, which also shortens literals and semicolons.
Click the "Process" button to strip comments and rebuild the script without unnecessary bytes.
Copy the minified output or download it, and always smoke-test it in your app before deploying.
Features
Frequently Asked Questions
Related Tools
JSON Formatter
Format and beautify JSON data with proper indentation.
JSON Validator
Validate JSON data and find syntax errors.
JSON Minifier
Minify JSON by removing whitespace and formatting.
HTML Formatter
Format and beautify HTML code.
HTML Minifier
Minify HTML code to reduce file size.
CSS Formatter
Format and beautify CSS code.
About JavaScript Minifier
Whitespace and comments in a script are pure weight at runtime. The JavaScript Minifier parses your code, then re-emits it with those removed, so blocks collapse and statements join together where doing so is safe. A readable 200 KB script commonly lands around 120 KB before any compression, and considerably less after gzip.
There are two levels, and the difference matters. Safe mode only strips comments and redundant whitespace, leaving every identifier exactly as you wrote it. Aggressive mode additionally shortens the true and false literals, drops trailing semicolons where the grammar allows it, and normalises numeric and string forms. Neither mode renames variables, because renaming is the step that breaks stack traces and makes production debugging miserable.
The distinction from a real bundler is worth understanding. A tool such as terser also does mangling, dead code elimination, and function inlining, so it usually produces something smaller. This one does the predictable half of the job, which is the half you can eyeball and be confident is equivalent to what you wrote.
When to Use This Tool
- Shrinking a script tag on a landing page before the main build pipeline exists
- Reducing the size of a standalone widget or embed script
- Preparing a snippet for a CMS that stores code as plain text
- Trimming an inline script before pasting it into an email template
- Comparing two versions of a script by minified size