Install JS Beautify
Install the package globally to get the
js-beautify, css-beautify, and html-beautify CLI tools, or locally for use as a Node.js library.Beautify a file from the CLI
Pass a file path to the beautifier. Output goes to To overwrite the file in place:For CSS and HTML:
stdout by default.Use as a Node.js library
Require
js-beautify and call the appropriate method for each language. All three methods accept (sourceCode: string, options?: object) and return the formatted string.Use from Python
Import
jsbeautifier and call beautify() or beautify_file().The Python
jsbeautifier package only supports JavaScript. For CSS, install cssbeautifier separately: pip install cssbeautifier.Next steps
Configuration Options
Explore all 40+ options for controlling indentation, brace style, line wrapping, and more.
.jsbeautifyrc
Store your settings in a project config file automatically picked up by the CLI.
CLI Reference
Full reference for all CLI flags and options.
API Reference
Complete API documentation for the JavaScript, CSS, and HTML beautifier functions.