How to use the JavaScript Formatter
- Paste your JavaScript into the left box, or open a file.
- Adjust the options if you need to.
- Copy the formatted JavaScript or download it as a file.
What does this tool do?
The formatter re-prints your code with consistent indentation and line breaks. It doesn't rename variables, so minified names stay short — but the structure becomes easy to follow.
Why use it?
- Debug minified scripts.
- Review code snippets from tickets and chats.
- Never executes your code.
Example
function f(a){return a*2} becomes
function f(a) {
return a * 2
}Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
Will formatting change how my code runs?
No. Only whitespace and line breaks change. The code is re-printed, never executed.
Can it restore the original variable names of minified code?
No. Minifiers throw the original names away, so there's nothing to restore. If the site publishes source maps, browser developer tools can use those to show the original code.
Last reviewed by the M2Toolkit team.