FormatBentoJavaScript
JavaScript beautifier & minifier
Make a minified bundle readable again with Prettier, or shrink readable code with terser and see exactly how many bytes you saved.
The formatted code lands in this compartment. Ctrl + Enter formats from the keyboard.
Syntax error
Ready. Paste code, open a file or press Sample.
Runs in your browser · nothing is uploadedBeautify or minify
Beautify parses the code with Babel and prints it with Prettier, so a one-line bundle becomes indented, consistently quoted code. Names shortened by a minifier stay short; nothing can bring the originals back except a source map.
Minify uses terser, loaded the first time you need it. The output meta line shows the new size, the percentage saved and the gzip size, which is closer to what is actually sent over the network.
- Compress
- Removes dead code, folds constants and joins statements.
- Shorten names
- Renames local variables. Top-level names stay unless ES module is on, because other scripts may use them.
- Keep licence comments
- Keeps comments that start with
/*!or contain @license or @preserve.
Questions
Does it handle JSX and modern syntax?
Beautify accepts JSX and everything Babel parses. For TypeScript, use the home page and pick TypeScript.
Is minified code safe to ship?
terser is the minifier behind most bundlers, and these are its standard options. Test the result like any build output.
Is my code uploaded?
No. Prettier and terser run in this tab; proprietary code stays on your machine.