Minifying JavaScript removes whitespace and comments, simplifies expressions and renames local variables to single letters. Scripts commonly shrink by half or more.
The work is done by Terser, the minifier behind most build tools, running in your browser. Beautify takes compressed code and lays it out with indentation so you can follow it.
How to use the JavaScript Minifier and Beautifier tool
- Paste the JavaScript or open a file.
- Choose Minify or Beautify; untick shortening names if other scripts call your functions by name.
- Copy the script or download it.
Popular uses
- Shrinking a script for a website without a build step
- Reading a minified library to debug it
- Preparing snippets for bookmarklets and embeds
Tips for the best result
- Global function names are never renamed, so code that other files call keeps working.
- A syntax error is reported with its line; fix it and the result appears.
Quick facts
| Price | Free |
|---|---|
| Works with | JavaScript |
| Where it runs | In your browser, on your device |
| Account | Not needed |