JavaScript Beautifier: Format and Indent JS Online
Paste JavaScript and get clean, indented code. Choose indent, line width, semicolons and quote style. It handles modern syntax and JSX. Runs in your browser.
Paste your JavaScript and press Beautify. The code is re-indented, long lines wrap at the width you choose, and you can add semicolons or switch quote style. Modern syntax such as arrow functions, classes, async and JSX is supported.
What it does
- Re-indents blocks and puts one statement on each line.
- Wraps long lines at the width you choose.
- Adds or removes semicolons and switches quote style.
- Understands ES2023 syntax and JSX.
Example
Before
// add two numbers
function add(a,b){const total=a+b;if(total>10){console.log("big")}return total}
const items=[1,2,3].map(n=>add(n,2));After
// add two numbers
function add(a, b) {
const total = a + b;
if (total > 10) {
console.log("big");
}
return total;
}
const items = [1, 2, 3].map((n) => add(n, 2));
Frequently asked questions
- Can it unminify a minified file?
- Yes, it restores the line breaks and indentation. It cannot bring back original variable names or comments that were removed.
- Does it change what the code does?
- No. Only formatting changes. Adding semicolons follows the language rules, so the behaviour stays the same.
- Does it support TypeScript?
- Not on this page. TypeScript syntax may show an error.
- What does an error mean?
- The code has a syntax error that the parser could not read. The message names the problem; fix it and press Beautify again.
More tools
Code formatters
CSS beautifier CSS minifier HTML beautifier HTML minifier JavaScript minifier JSON formatter YAML formatter XML formatter SQL formatter Markdown preview
Converters
Base64 encoder and decoder URL encoder and decoder Unix timestamp converter CSV to JSON JSON to CSV HTML entity encoder and decoder Number base converter Time zone converter JSON to TypeScript XML to JSON HTML to Markdown Date difference calculator
Text tools
Regex tester Remove duplicate lines Lorem ipsum generator Word counter Case converter Text diff checker
Color and images
Color converter Contrast checker Image to Base64 Image resizer
Network
Subnet calculator Download time calculator Common ports list CIDR to IP range IPv6 address expander and compressor MAC address formatter curl command builder
Server and files
Cron expression explainer chmod calculator HTTP status codes
Encoding and security
Password generator UUID generator Hash generator JWT decoder QR code generator Password strength checker Wi-Fi QR code generator