JavaScript Minifier
Reduce JavaScript size by safely removing comments and whitespace. Your code is processed as text in your browser — it is never executed or uploaded.
Loading tool…
Need help with this tool or found a problem? WhatsApp support Email
What does the JavaScript Minifier do?
This minifier uses a tokenizer that understands strings, template literals (including nested ${…}), regular-expression literals and comments, so it never breaks code by removing something inside a string. Line breaks are kept wherever JavaScript’s automatic semicolon insertion might depend on them, which keeps code without semicolons working.
It does not rename variables or remove dead code. For maximum compression in production, use a build tool such as esbuild or Terser; this tool is ideal for quick snippets, bookmarklets and inline scripts.
How to use the JavaScript Minifier
- Paste your JavaScript.
- Choose whether to keep /*! license */ comments.
- Copy or download the minified code and check the saving.
Examples
Snippet
A 20-line function with comments typically shrinks by 30–50% without changing behaviour.
Common use cases
- Inline scripts in HTML pages
- Bookmarklets
- Quick optimisation of small libraries
Features and benefits
- Private by design — your data is processed on your device and never uploaded.
- Free with no account, no watermark and no usage limits.
- Works on phones, tablets and desktops in any modern browser.
Limitations to know
- No variable renaming or tree-shaking.
- Unusual syntax (such as a regex directly after a closing brace) may be misread; test the output.
Frequently asked questions
Will minified code run the same?
It is designed to, and keeps line breaks where they matter. Always test before deploying.
Why is the result not as small as Terser?
Terser also renames variables and removes unused code, which requires a full parser.
Is my code executed?
No, it is only processed as text.
Related tools
All developer toolsJavaScript Beautifier
Re-indent minified or messy JavaScript.
CSS Minifier
Minify CSS to reduce stylesheet size.
HTML Minifier
Minify HTML by removing comments and extra whitespace.
JSON Minifier
Minify JSON by removing whitespace.
Remove Extra Spaces
Collapse double spaces, trim lines and remove blank lines.
Text ToolsJSON Formatter
Beautify JSON with indentation and syntax error locations.