How to use the JavaScript formatter
Paste a script, choose a mode and copy the result. The output updates as you type.
- Paste JavaScript into the Input box, or press Paste. A minified bundle, a function copied from dev tools and a whole module all work, and Try it loads a short example.
- Set Mode to Beautify to re-indent the code, or to Safe minify (keeps line breaks) to remove comments and indentation.
- Choose the Indent: 2 spaces, 4 spaces or Tab. It only affects Beautify.
- Read the status line. It says "Beautified", or for Safe minify it shows the length before and after.
- Press Copy or Download .txt, then rename the download to .js. Use as input moves the result back into the input box.
Beautify uses the js-beautify library in your browser. Nothing is uploaded, and the tool never runs the code it formats, so pasting an unknown script here is safe even when running it would not be.