JavaScript Formatter
Beautify JavaScript with consistent indentation and spacing. Strings, template literals and regular expressions are preserved.
Runs in your browser. Your input is processed on your device and is not uploaded to our server.
How to use the JavaScript Formatter
- Paste your code or open a file.
- Choose the indentation and click Format.
- Check the result and the size change, then copy or download it.
The formatter tokenises the code (so strings, template literals, regular expressions and comments are not altered) and re-indents blocks with consistent spacing around operators. It is a lightweight beautifier, not a full parser: for team-wide formatting rules use a dedicated tool such as Prettier in your editor.
Frequently asked questions
Can it un-minify code?
It restores indentation and line breaks, but not the original variable names, which minifiers usually shorten.