JavaScript Beautifier & Unminifier
Paste a minified bundle or a wall of compressed JavaScript and get back readable, indented source with consistent spacing and brace placement. An optional toggle sorts object literal keys alphabetically.
This is a formatter, not a decompiler. It restores whitespace and structure, which makes minified code readable, but it cannot recover variable names that a minifier replaced with single letters.
How to use it
- Paste JavaScript on the left, or press Sample to load a minified example.
- Choose an indent width; the formatted output appears on the right.
- Optionally enable Sort keys to alphabetise object literal properties.
- Use Format in place to replace your input, or copy and download the result.
How key sorting stays safe
Sorting reorders the original source text of each property using an acorn syntax tree, rather than regenerating code from that tree. Regeneration would silently discard comments and rewrite string quoting, which is unacceptable when the whole reason you are here is to read somebody else's code.
Objects containing a spread such as {...rest, a: 1} or a computed key such as {[k]: 1} are left in their original order, because moving properties around either of those changes which value ultimately wins. Nested objects are still sorted at every level, including inside a parent that could not itself be reordered.
Syntax support
Parsing targets the latest ECMAScript version with module syntax enabled, so classes, private fields, optional chaining, nullish coalescing, async and await, and top-level await all parse. Hashbang lines are accepted.
If a document cannot be parsed — which happens with some heavily obfuscated bundles — formatting still runs and a notice explains that keys could not be sorted, rather than failing outright.
Frequently asked questions
Does sorting object keys change how my code behaves?
- For plain objects, no: property order does not affect lookup. The tool refuses to reorder the two cases where it would matter — objects containing a spread, and objects with computed keys — since in both the later entry can overwrite an earlier one.
Are comments preserved?
- Yes. Because sorting moves original source slices rather than regenerating code, comments attached to a property move with it.
Can it deobfuscate or unpack code?
- It unpacks formatting, so packed one-liners become readable. It does not rename mangled identifiers or reverse control-flow flattening — that information is destroyed by the minifier and cannot be recovered from the source alone.
Is my source code sent to a server?
- No. Parsing and formatting both happen in your browser, which matters when the bundle you are inspecting is proprietary.