Javascript beautifier


This beautifier can process your messy or compacted javascript, making it all neatly and consistently formatted and readable.

You can always see the latest version of the code in github, and you can download the beautifier for local use (zip, tar.gz) as well.

Unpacking javascript

The beautifier has a simple unpacker for Dean Edward's packer. To unpack javascript, paste (p,a,c,k,e,d) scripts and they'll hopefully get decoded. Your feedback is welcome.

Formatting from command-line

To beautify from the command-line you can use provided beautify-cl.js script, using Rhino javascript engine. See the file contents for the details.

Fiddler

This popular web debugging proxy for Windows has a Javascript Formatter addon (based on this beautifier) which can reformat javascript on the fly.

Vim

Aj3423 converted the script to vimscript — and so now there is a vim plugin for the quality javascript beautifying.

Other nice things

If you're writing javascript code, JSLint is a really fine piece of software, too. You don't have to follow its recommendations blindly, but understanding what it says about your code can greatly improve your skills.

Contacts

If you find some problems with the generated javascript, adapt the script for your favorite editor, or something, my email is einars@gmail.com.