Installation
Install via npm, pip, or use the CDN — get up and running in seconds.
Quickstart
Beautify your first file in under a minute.
Configuration
Explore all 40+ options to tailor output to your style guide.
API Reference
Full API reference for JavaScript, CSS, HTML, and Python.
What is JS Beautify?
JS Beautify reformats and re-indents JavaScript, CSS, and HTML source code. It handles minified code, unpacks scripts packed by Dean Edward’s packer, and partly deobfuscates scripts processed byjavascript-obfuscator.
You can use it in multiple environments:
Node.js Library
require('js-beautify') — beautify strings programmatically in Node.js or the browser.CLI Tool
js-beautify, css-beautify, and html-beautify executables for shell workflows.Python Package
jsbeautifier and cssbeautifier packages on PyPI.Web Browser
Embed via CDN — exposes
js_beautify, css_beautify, and html_beautify globally.Key features
JavaScript, CSS, and HTML beautification
JavaScript, CSS, and HTML beautification
Reformat minified or poorly indented source code back to a human-readable form. Supports ES6+, JSX, and modern CSS.
40+ configuration options
40+ configuration options
Control indentation style, brace placement, line wrapping, newline behavior, operator position, and much more — all from a single config file or CLI flags.
EditorConfig integration
EditorConfig integration
Automatically inherit indentation settings from your project’s
.editorconfig file by passing --editorconfig.Templating language support
Templating language support
Beautify HTML templates written with Django, Handlebars, ERB, PHP, Smarty, and Angular control flow syntax without corrupting template tags.
Beautify directives
Beautify directives
Embed
/* beautify ignore:start */ / /* beautify ignore:end */ or preserve directives directly in your source to protect sections from reformatting.Language-specific overrides
Language-specific overrides
Apply different indent sizes or settings to JS, CSS, and HTML through a single
.jsbeautifyrc config file with nested language keys.Quick example
Node.js library
Try it live at beautifier.io — no installation required.