How to Unminify JavaScript (Beautify Minified JS Safely)
Paste minified JS, get readable formatting with an unminifier — then know what beautifying can and cannot recover, and when JS on the wire belongs in an AI pentest.
Production is misbehaving. DevTools shows a one-line bundle. You need to see structure before you grep for endpoints — but unminify only fixes layout; mangled names stay a, b, e unless you have a source map.
Paste minified JS into a beautifier to get braces and newlines back. That is formatting recovery, not a rebuild of your TypeScript tree.
What unminify actually does
Minification strips whitespace, shortens names, inlines code. An unminifier reverses layout. Comments and original file boundaries are gone after bundling.
Reach for unminify when you:
- Skim a production bundle during an incident
- Review third-party script behavior you are allowed to inspect
- Want readable structure before grepping for
eval,document.write, or hard-coded URLs
When you own the repo, read source before compile — do not substitute a web formatter for git.
How to unminify JS in the browser
- Open the unminify tool.
- Paste minified JavaScript (CSS/HTML work on many formatters too).
- Run format and copy output.
- Search for URLs, API keys, feature flags, dangerous sinks.
Keep pastes small in any online tool. Run local formatters on large proprietary bundles.
Unminify vs source maps vs DevTools
| Approach | Best for | Limitation |
|---|---|---|
| Unminify / beautify | Quick readability of any paste | Mangling stays |
Source maps (.map) | Debugging your builds | Must retain maps securely |
| Browser DevTools | Live pages with maps | Depends on published maps |
Own the app? Emit maps in staging. Keep production maps off public CDNs unless you accept that disclosure tradeoff.
Security angle: what shows up in shipped JS
Every visitor downloads production JavaScript. Teams still ship:
- Hard-coded API keys or “temporary” tokens
- Internal hostnames and staging URLs
- Feature flags that expose admin UI
- Auth logic that should never run in the browser
Beautifying makes those easier to spot. A string in a bundle is not exploitability — authorized testing proves impact. AI pentest workflows favor findings with repro steps, not every interesting string labeled critical.
Practical workflow for engineers
- Copy script URL from DevTools → Network.
- Unminify a chunk, not a 5 MB vendor blob when you can.
- Tag third-party vs first-party scripts.
- Grep for
Authorization,apiKey,secret,password,localhost, private IP patterns. - On your app, file remediation or schedule authorized assessment — do not probe production blindly.
What unminifying cannot do
- Recover deleted comments and file boundaries
- Undo deliberate obfuscation (control-flow flattening, string encryption)
- Prove a vulnerability without a request/response showing impact
- Replace static analysis of the repository you own
Beautify vs deobfuscate
Beautifying restores formatting. Deobfuscation fights hostile packers — results vary. One-click “original TypeScript recovery” from a packed bundle is marketing.
For apps you ship: readable git source, CI that blocks secret commits, bundler settings without staging credentials in customer bundles, dynamic testing on systems you are allowed to hit.
Unminify is a flashlight, not your build pipeline.
When to escalate beyond a formatter
Beautified output showing:
- Admin routes without auth
- Tokens calling privileged APIs
- Client-trusted crypto or auth
- Scripts from unexpected hosts
Those are hypotheses. Confirm on authorized scope — ideally with recorded proof, not secrets pasted into tickets.
FAQ
Is unminifying legal?
Formatting what your browser already fetched for a site you may access is ordinary debugging. Do not redistribute proprietary source or test systems you are not authorized to assess.
Why is beautified code still unreadable?
Mangling and packing leave one-letter names. Source maps or git are the fix.
Should production expose source maps?
Usually no on public sites. Private map storage for error reporting is fine.
CSS and HTML too?
Yes — same tools. CSS rarely hides secrets like JS; long selectors can still leak path hints.
Summary
Unminify restores whitespace and structure, not original names. Use unminify for quick orientation; use source maps and git when you own the build. Grep shipped JS for secrets and sinks, then prove impact only on authorized targets.