JavaScript Beautifier
Beautify JavaScript code with consistent indentation and proper formatting. Copy or download the result without sending data anywhere.
JavaScript Beautifier
This JavaScript Beautifier takes minified, compressed, or poorly indented JavaScript code and reformats it with consistent indentation, proper spacing, and clean line breaks. It makes obfuscated or bundled code readable for debugging and analysis.
The beautification runs entirely in your browser using the js-beautify library. Your code never leaves your device, making it ideal for formatting minified scripts, analyzing bundled assets, or cleaning up auto-generated code.
How to use
- Paste your minified or messy JavaScript into the input editor.
- Click Beautify JavaScript to apply indentation and formatting.
- View the formatted code in the output editor with proper structure.
- Use Copy for the clipboard, Download for a .js file, or Clear to reset both editors.
What is JavaScript beautification?
JavaScript beautification (also called prettifying or unminifying) is the process of reformatting JavaScript source code to follow consistent style rules. It adds proper indentation, line breaks, and spacing around operators, keywords, and blocks to make the code structure visually clear.
This is particularly useful when working with minified production scripts, third-party libraries distributed in compressed form, or code generated by bundlers like Webpack or Rollup. Beautified code is much easier to read, debug, and understand.
Input notes
The tool accepts any valid JavaScript input, from single expressions to full programs. It handles ES6+ syntax, arrow functions, template literals, destructuring, and other modern JavaScript features. The beautifier does not validate syntax, so even partially valid code can be reformatted.
Example
Minified JavaScript becomes readable after beautification:
--- Input (minified) ---
function greet(n){if(n){console.log("Hello, "+n+"!")}else{console.log("Hello!")}}
--- Output (beautified) ---
function greet(n) {
if (n) {
console.log("Hello, " + n + "!");
} else {
console.log("Hello!");
}
}