🌐
npm
npmjs.com › package › js-beautify
js-beautify - npm
This little beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package javascript-obfuscator.
      » npm install js-beautify
    
Published   Feb 27, 2025
Version   1.15.4
Author   Einar Lielmanis
🌐
GitHub
github.com › beautifier › js-beautify
GitHub - beautifier/js-beautify: Beautifier for javascript · GitHub
This little beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package javascript-obfuscator.
Author   beautifier
🌐
npm
npmjs.com › package › beautifier
beautifier - npm
The JavaScript, html, and css beautifier. Latest version: 0.1.7, last published: 13 years ago. Start using beautifier in your project by running `npm i beautifier`. There are 18 other projects in the npm registry using beautifier.
      » npm install beautifier
    
Published   Oct 29, 2012
Version   0.1.7
Author   Rickey Visinski
🌐
SourceForge
sourceforge.net › projects › js-beautifier.mirror
JS Beautifier download | SourceForge.net
Download JS Beautifier for free. Beautifier for javascript. This little beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package javascript-obfuscator.
🌐
npm
npmjs.com › package › gulp-jsbeautifier
gulp-jsbeautifier - npm
js-beautify for gulp. ... All options are optional. ... Contains specific beautifier options for CSS, HTML and JavaScript.
      » npm install gulp-jsbeautifier
    
Published   Jul 25, 2019
Version   3.0.1
Author   Tarun Chaudhry
🌐
npm
npmjs.com › package › beautify
beautify - npm
npm · Sign UpSign In · 0.0.8 • Public • Published 9 years ago · Readme · Code Beta · 3 Dependencies · 34 Dependents · 3 Versions · Beautify CSS/JS/JSON/HTML/XML formats · npm i beautify -g · beautify [options]: -h, --help output ...
      » npm install beautify
    
Published   Oct 03, 2016
Version   0.0.8
Author   Konstantin Gorodinskiy
🌐
npm
npmjs.com › search
jsbeautifier - npm search
An up-to-date version of js-beautify for Assemble's helpers.
🌐
Kali Linux Tools
en.kali.tools
JS Beautifier - Penetration Testing Tools
sudo pacman -R python-jsbeautifier sudo pacman -S npm sudo npm -g install js-beautify js-beautify -h · Another installation option is installation from AUR. This is the recommended way to install JS Beautifier because it gives you the full version of the program with automatic updates when new versions are released.
🌐
npm
npmjs.com › package › @bmewburn › js-beautify
@bmewburn/js-beautify - npm
This little beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package javascript-obfuscator.
      » npm install @bmewburn/js-beautify
    
Published   Jun 21, 2024
Version   1.15.2
Author   Einar Lielmanis
🌐
npm
npmjs.com › search
beautify - npm search
beautifier · code-quality · scrum• 0.7.0 • 6 years ago • 9 dependents • MITpublished version 0.7.0, 6 years ago9 dependents licensed under $MIT · 17,677 · Some tweaks for beautifying HTML with js-beautify according to my preferences. beautify · format ·
Find elsewhere
🌐
npm
npmjs.com › package › js-prettify
js-prettify - npm
This is a copy of the original 1.4.0 repo (https://github.com/jonschlinkert/js-prettify) created by Jon Schlinkert. This is only for archiving purposes. This little beautifier will reformat and reindent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as deobfuscate scripts processed by javascriptobfuscator.com.
      » npm install js-prettify
    
Published   Jan 17, 2014
Version   1.4.0
🌐
npm
npmjs.com › search
code beautifier - npm search
A highly configurable, easily modifiable source code beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA
🌐
GitHub
github.com › Unibeautify › beautifier-js-beautify
GitHub - Unibeautify/beautifier-js-beautify: JS-Beautify beautifier for Unibeautify · GitHub
JS-Beautify beautifier for Unibeautify · npm install --global @unibeautify/beautifier-js-beautify ·
Author   Unibeautify
🌐
npm
npmjs.com › package › es-beautifier
es-beautifier - npm
ECMAScript beautifier based on eslint. Latest version: 1.2.0, last published: 7 years ago. Start using es-beautifier in your project by running `npm i es-beautifier`. There are 0 other projects in the npm registry using es-beautifier.
      » npm install es-beautifier
    
Published   Apr 16, 2019
Version   1.2.0
🌐
GitHub
github.com › TALLStackHub › js-beautify
GitHub - TALLStackHub/js-beautify · GitHub
npm install js-beautify-with-blade · Beside all the usage examples you can found at the orignal js-beautify. You can use this package as blade beautifier · npx html-beautify resources/views/**/*.blade.php -r · run the above command in your ...
Author   TALLStackHub
🌐
Bayern
umweltatlas.bayern.de › mapapps › resources › jsregistry › root › js-beautify › latest › README.md
js-beautify/README.md (latest)
As with the Python script, the beautified result is sent to stdout unless otherwise configured. $ npm -g install js-beautify $ js-beautify foo.js · You can also use js-beautify as a node library (install locally, the npm default): $ npm install js-beautify ·
🌐
GitHub
github.com › psyrendust › js-prettify
GitHub - psyrendust/js-prettify: This little beautifier will reformat and reindent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as deobfuscate scripts processed by [javascriptobfuscator.com](http://javascriptobfuscator.com/).
As with the Python script, the beautified result is sent to stdout unless otherwise configured. $ npm -g install js-beautify $ js-beautify foo.js · You can also use js-beautify as a node library (install locally, the npm default): $ npm install ...
Author   psyrendust
Top answer
1 of 10
76

First, pick your favorite Javascript based Pretty Print/Beautifier. I prefer the one at http://jsbeautifier.org/, because it's what I found first. Downloads its file https://github.com/beautify-web/js-beautify/blob/master/js/lib/beautify.js

Second, download and install The Mozilla group's Java based Javascript engine, Rhino. "Install" is a little bit misleading; Download the zip file, extract everything, place js.jar in your Java classpath (or Library/Java/Extensions on OS X). You can then run scripts with an invocation similar to this

java -cp js.jar org.mozilla.javascript.tools.shell.Main name-of-script.js

Use the Pretty Print/Beautifier from step 1 to write a small shell script that will read in your javascript file and run it through the Pretty Print/Beautifier from step one. For example

//original code    
(function() { ... js_beautify code ... }());

//new code
print(global.js_beautify(readFile(arguments[0])));

Rhino gives javascript a few extra useful functions that don't necessarily make sense in a browser context, but do in a console context. The function print does what you'd expect, and prints out a string. The function readFile accepts a file path string as an argument and returns the contents of that file.

You'd invoke the above something like

java -cp js.jar org.mozilla.javascript.tools.shell.Main beautify.js file-to-pp.js

You can mix and match Java and Javascript in your Rhino run scripts, so if you know a little Java it shouldn't be too hard to get this running with text-streams as well.

2 of 10
64

UPDATE April 2014:

The beautifier has been rewritten since I answered this in 2010. There is now a python module in there, an npm Package for nodejs, and the jar file is gone. Please read the project page on github.com.

Python style:

$ pip install jsbeautifier

NPM style:

$ npm -g install js-beautify

to use it (this will return the beatified js file on the terminal, the main file remains unchanged):

$ js-beautify file.js

To make the changes take effect on the file, you should use this command:

$ js-beautify -r file.js

Original answer

Adding to Answer of @Alan Storm

the command line beautifier based on http://jsbeautifier.org/ has gotten a bit easier to use, because it is now (alternatively) based on the V8 javascript engine (c++ code) instead of rhino (java-based JS engine, packaged as "js.jar"). So you can use V8 instead of rhino.

How to use:

download jsbeautifier.org zip file from http://github.com/einars/js-beautify/zipball/master

(this is a download URL linked to a zip file such as http://download.github.com/einars-js-beautify-10384df.zip)

old (no longer works, jar file is gone)

java -jar js.jar  name-of-script.js

new (alternative)

install/compile v8 lib FROM svn, see v8/README.txt in above-mentioned zip file

./jsbeautify somefile.js

-has slightly different command line options than the rhino version,

-and works great in Eclipse when configured as an "External Tool"

🌐
GitHub
github.com › beautifier › js-beautify › blob › main › README.md
js-beautify/README.md at main · beautifier/js-beautify
This little beautifier will reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package javascript-obfuscator.
Author   beautifier
🌐
Npm
npm.io › search › keyword:beautify
Beautify | npm.io
jsonobjectnotationsafestringifyparseread-filewrite-filecommentscircular2.0.0 • Published 7 years ago · HTML prettifier with options to format HTML according to your own preferences. beautifierbeautifycodeformatformatterformattinggruntgruntpluginhtmlindent0.4.0 • Published 11 years ago