JS Minifier & Beautifier
Minify JavaScript with Terser, or format minified code with indentation.
Minified
Examples
Questions
What does "Rename variables" change?
With it on (the default), local variables and parameters get the shortest names possible. That's where most of the savings come from after removing whitespace. Turn it off to keep your names, so the output stays readable.
Why do minify and beautify use different libraries?
Minifying has to parse the code to rewrite it safely, so it uses Terser. Beautifying only reprints the code with indentation. Each library is loaded only when you use it.
What happens with invalid JavaScript?
Minifying needs valid code, so a syntax error is shown with its line and column. Beautifying is more forgiving and reprints what it can.
Does minifying change what the code does?
No. Terser removes whitespace and comments, shortens names, folds constants and drops dead code, all without changing behavior.
Related tools
- CSS Minifier & BeautifierMinify CSS, or format minified CSS with indentation.
- JSON Formatter & ValidatorFormat, minify, check and repair JSON, with errors shown by line and column.
- SQL FormatterFormat SQL with consistent indentation and keyword case, for eight dialects.
- Contrast CheckerCheck WCAG contrast between two colors, and get a fix when it fails.