
Debug Minified JavaScript: Source Maps and DevTools
Debug minified JavaScript without guessing: Chrome pretty-print, source maps in production, and a local unminify step when maps are missing.
The problem with minified code in production
A production TypeError on `main.js:1:245` calls for debugging, not for “paste this into an online unminifier.” Minification strips whitespace and comments. Mangling renames functions to `a`, `b`, `c`. Pretty-printing restores the layout. Only a source map restores the original names. If maps are missing, and you need a local copy, use the JavaScript unminifier, knowing that identifiers stay mangled.
When production JavaScript is unreadable
These are debugging problems. Unminifying is one tactic, not the default.

Formatting is not decompilation. Treat these limits as hard:

Limitations:
What works:
When to unminify and when to pretty-print
Do not start by pasting into a tool. Follow this order. The unminify JavaScript page is step 3, for when maps are missing.

1Look for a source map
In DevTools → Sources, look for original files next to the bundle, a `.map` sibling file, or a `//# sourceMappingURL=` comment. If a map loads, debug there and stop.
2Pretty-print in the browser or editor
In Chrome Sources, the `{}` Pretty Print control formats the file in place. In VS Code, run Format Document (built-in JS formatter or Prettier) on a saved `.min.js`. The limit is the same: names stay mangled.
3Unminify locally only if you need a file copy
If there is no map, and you want indented source on disk or in another tool, paste the code into unminify JavaScript. Processing stays in your browser. The format settings are the indent size and the indent character (spaces or tabs), and the tool does not deobfuscate.
4Navigate with literals, not names
Search for unique strings, URLs, and error messages. Follow `if` / `return` / `.then(` patterns. Do not wait for `a` to become a real identifier.
Example:
Before (minified):
After (unminified):
Pretty-print (or a source map) should come before copying a megabyte of bundle into an editor.

Minified code:
Unminified code (preview):
Source maps are the most direct way to debug production code
A `.map` file records how minified positions map back to the original sources. DevTools can then show real file names, original identifiers and breakpoints in the code you wrote, which no unminifier can reconstruct.

In Webpack 5, set `devtool` (the `sourceMap: true` option of TerserPlugin no longer exists). In Vite, use `build.sourcemap: true` or `'hidden'`. Standalone Terser can still attach a map object, as below.
Terser
Webpack
Debugging with browser DevTools
Chrome (and other Chromium-based browsers) can format the file you are already inspecting. That is faster than exporting the bundle when you only need to read the crashing line. Format Document in VS Code on a saved `.min.js` is the editor equivalent, and it is still not a source map.

Once DevTools (or an editor) has formatted the file, line numbers refer to the pretty-printed view unless a map is active:
Tips:
When you still need a local formatted copy
These options re-indent JavaScript. None of them restores mangled names. Expanding minified JavaScript is the job of unminify JavaScript. The sibling page beautify JavaScript is the formatter page, and minify JavaScript is the inverse operation.
FastMinify: Unminify JS
Unminifier that runs in your browser: paste a minified snippet and get indented output. The only settings are the indent size and spaces or tabs. Nothing is uploaded.
Pros:
Cons:
VS Code + Prettier
Save the file and run Format Document. This is the usual “unminify in VS Code” route: the same readability gain as pretty-print, still without original identifiers.
Pros:
Cons:
JS Beautifier
Open-source formatter (js-beautify) available as a library, CLI, and various web UIs. Same class of tool: whitespace and structure, not original symbols.
Pros:
Cons:
Next steps
Debug minified JavaScript in this order. Use source maps if they exist. Pretty-print in DevTools or VS Code if you only need to read the crashing line. Use a local unminifier only when you need a formatted copy and maps are missing. The tool does not undo mangling. Fix the build, so the next incident has maps.
If maps are missing, and you need indented source locally, use the browser unminifier, then go back to DevTools.
Related Articles

Paste a token and a JWKS to check an RS256, ES256 or HS256 signature in your browser. How kid picks the key, measured errors and the claims to check.

HTTP/2 and HTTP/3 change how files travel, not how big they are. Measured sizes, compile times and bundling tests show what minification still saves.

Convert a Unix epoch to a readable date and back, tell seconds from milliseconds, and avoid time zone, JWT and clock change traps, all in your browser.