JavaScript minifier
Smaller, and provably the same code.
Output
Paste or type above to see the result here.
Your files stay on your device
This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.
How it works
- Paste the JavaScript.
- Comments and indentation go; names stay exactly as they were.
- Check the saving in the figures above the output.
- Copy or download the result.
Frequently asked questions
- Why does it not shorten my variable names?
- Because renaming needs a real parser and a scope analysis, and getting that subtly wrong ships a file that runs until it doesn’t. A tool that promises less and is always right is the better trade for something you are about to put in front of users. For the last few percent, use esbuild or terser in your build.
- Can it tell a regular expression from a division?
- Yes — that is the one genuinely hard part of reading JavaScript without parsing it. A slash after a value is division; after an operator, a keyword or nothing, it opens a regular expression. So /ab+c/g survives and total / 2 is still a division.
- Will it break automatic semicolon insertion?
- No. A newline can stand in for a semicolon, so lines are only joined when the break provably cannot be one — when the line before ends mid-expression, or this one starts with a closing bracket. Everything else keeps its newline.
- Is my licence header removed?
- No. A comment beginning /*! or containing @license or @preserve is kept; the rest go.
- Is anything sent to a server?
- No. It runs in your browser, so what you paste stays on your computer.
Related tools
◒ CSS formatter One declaration to a line, or the whole file on one. ‹› HTML formatter Indented so you can read it, or squeezed so you can ship it. {} JSON Formatter Paste JSON, get it indented, minified or validated instantly. Your data stays on this page. ∿ Base64 Convert text to Base64 and back, with correct UTF-8 handling and an optional URL-safe alphabet.