JavaScript formatter (indent and beautify)
Format minified or messy JavaScript online: 2 or 4 space or tab indentation, braces on the same line or the next, and wrapping of long lines, to read and debug any site's scripts.
How to usePaste your JavaScript.
JavaScript formatter (indent and beautify): what it is for
Minified scripts arrive on a single line, impossible to read or debug. Paste the code and it gets one statement per line again, with 2 or 4 space or tab indentation, braces on the same line or the next and wrapping at 100 columns.
The structure is recovered, but variable names shortened by minification do not come back, because they are no longer in the file. JSON is formatted too. The code is not executed: the tool only rearranges the text, in your browser, with the js-beautify library.
How to use
- Paste the JavaScript.
- Choose the indentation and brace style.
- Copy or download the result.
When to use it
- Reading a third-party script.
- Debugging minified code.
- Tidying copied snippets.
Frequently asked questions
Does formatting recover the original code of a .min.js?
It recovers the structure: indentation, line breaks and one statement per line. Variable names shortened by minification (a, b, c) do not come back, because the original names are no longer in the file.
Does it work with JSON and TypeScript?
JSON is formatted normally. In TypeScript, most code comes out right, but complex types and decorators may get odd spacing; check before using it.
Is the code executed?
No. The tool only rearranges the text; the script does not run in your browser.
Is it really free?
Yes, 100% free. No sign-up, no subscription and no usage limits. All Tools123 tools are free and run right in your browser.