Skip to main content
JS Beautify reformats and re-indents JavaScript, CSS, and HTML. It unpacks scripts packed by Dean Edwards’ packer, and partly deobfuscates scripts processed by javascript-obfuscator. You can use it in the browser at beautifier.io, from the command line, or as a library in your Node.js or Python project.

Key features

JS, CSS, and HTML

Beautify all three languages from a single package. Dedicated js-beautify, css-beautify, and html-beautify executables are included, or call each formatter programmatically.

40+ configuration options

Control indentation size and character, brace style, line wrapping, operator position, comma placement, and more. Options are consistent across the CLI and library APIs.

EditorConfig support

Pass --editorconfig to read indent style, indent size, and end-of-line settings directly from your project’s .editorconfig file.

Templating language support

Preserve template syntax from Django, ERB, Handlebars, PHP, Smarty, and Angular inside HTML files. Use --templating auto to detect automatically.

In-source directives

Use /* beautify ignore:start */ and /* beautify ignore:end */ comments to exclude sections from formatting, or preserve:start / preserve:end to keep existing formatting in JavaScript and HTML.

Config file (.jsbeautifyrc)

Store your project settings in a .jsbeautifyrc JSON file at any level of the directory tree. Settings support language-specific overrides for js, css, and html blocks.

Available runtimes

RuntimePackageLanguages
Node.js (library + CLI)npm install js-beautifyJS, CSS, HTML
Python (library + CLI)pip install jsbeautifierJS only
Python CSSpip install cssbeautifierCSS only
Web / CDNcdnjs script tagsJS, CSS, HTML

Get started

Installation

Install JS Beautify for Node.js, Python, or as a web library via CDN.

Quickstart

Beautify your first file in under two minutes using the CLI or library API.

Getting help

Report bugs and request features on the GitHub issue tracker. Before opening a new issue, search existing issues to avoid duplicates.