JS Beautifier
Format and pretty-print minified or compressed JavaScript with proper indentation and consistent spacing.
About JS Beautifier
JavaScript Beautifier reformats minified or single-line JavaScript into readable code with consistent indentation. It tokenises the code preserving string literals and comments, then re-indents based on opening and closing braces, brackets, and parentheses.
Features
- Indent control - Choose 2 spaces, 4 spaces, or tab indentation.
- String-literal safe - Content inside quotes is never modified.
- Handles minified code - Adds line breaks after statements and blocks.
How to Use
- Paste your JavaScript (minified or compact) into the input area.
- Choose indentation style (2 spaces, 4 spaces, or tabs).
- Click Beautify - the formatted code appears in the output.
- Click Copy to copy the formatted JavaScript.
How It Works
The tool tokenizes the JavaScript and rebuilds it with consistent indentation inside blocks (functions, if/else, loops), newlines after statements, and proper spacing around operators. Comments and string literals are preserved exactly.
Example
Paste a minified library or bundle to make it readable for debugging: function a(b,c){return b*c;}var x=a(3,4); becomes a multi-line, properly indented version that is easy to read and edit.