Output appears here...How to use
Paste or upload code
Paste code into the Input pane, or click Upload file to load a .js, .jsx, .json, .html or .css file, which is formatted right away. Try sample loads a short minified script.
Set options and click Beautify
Pick Language, Indent, Braces, Blank lines and Wrap lines at, and tick any extra options. Click Beautify, or turn on Live mode so the output updates as you type.
Copy or download the code
Click Copy above the Output pane or download the file. Change an option to compare styles, or click Minify instead when you need the small version again.
Why JS Beautifier
- Indent, brace, blank-line and wrap options, plus JSX and chained-method settings.
- Auto-detects HTML and CSS and formats them with the right beautifier.
- Upload a file, download the result, or minify instead with Terser.
- Runs in your browser, so private code is not uploaded.
JS Beautifier vs Prettier vs a minifier
These three tools are often mixed up. A beautifier and Prettier both make code readable, but they work differently. js-beautify, which powers this page, adjusts spacing and line breaks and respects some of your existing layout, such as blank lines. Prettier reprints the whole file in one fixed style with few options, which is why teams use it to stop arguments about formatting.
A minifier does the opposite job and makes code smaller for production. A common workflow is to beautify a minified third-party file to understand it, fix or copy what you need, then let your build minify the final code.
| Tool | What it does | Good for |
|---|---|---|
| JS Beautifier (js-beautify) | Reformats layout with a few options | Quick one-off formatting in the browser |
| Prettier | Reprints code in one consistent style; supports TypeScript, JSX and CSS | Team projects, formatting on save or in CI |
| JavaScript Minifier (Terser) | Removes whitespace and comments, shortens names | Production files |