How to use it
- Paste your JavaScript, or open a .js file.
- Leave the action on Minify (preselected here).
- Tick or untick Shorten local variable names.
- Copy the result or download it as minified.min.js.
Worked example
A readable script goes in and a one-line version comes out, with the page showing how many bytes were saved and the percentage. With Shorten local variable names on, locals such as subtotal become single letters.
Formats and limits
| Input | JavaScript |
|---|---|
| Output | Minified JavaScript |
| Engine | Prettier standalone; Terser; CSSO; HTML whitespace/comment minifier with embedded CSS/JS minification |
Limitations
- JavaScript only on this page; HTML, CSS and JSON can be minified on the full tool, TypeScript and Markdown can only be formatted.
- Invalid JavaScript is reported, not minified.
- Renaming local names can break code that relies on them; untick the option then.
Questions
What does Shorten local variable names do?
It renames local variables and functions to one or two letters; globals and property names are never renamed. Untick it if other code depends on those local names.
Are comments removed?
Yes, except license comments such as /*! ... */ and @license blocks, which Terser keeps.
Why does it report a syntax error?
Terser needs valid JavaScript. Fix the error at the position shown and run it again. TypeScript can only be formatted here; compile it to JavaScript first.
Is my code uploaded?
No. The text is processed in your browser and nothing is uploaded.
Privacy
Runs on your device. Files and text are processed in this browser tab and are not uploaded.
This page opens the Code formatter and minifier ready for this task. See the privacy policy for how toolsdocks handles data.