JavaScript Deobfuscator

Unpack and beautify JavaScript to make obfuscated code readable.

JavaScript Deobfuscator

Unpack common packer wrappers, decode safe literals, and beautify JavaScript for easier review.

JavaScript input
Max 5000 characters.
Mode
Tries safe literal decoders like atob('...'), unescape('%xx'), and String.fromCharCode(...).
Result

Run the tool to see deobfuscated output here. Use “Beautify only” for minified code, or “Unpack + Beautify” when you see a packer wrapper.

About JavaScript Deobfuscator

JavaScript Deobfuscator – Deobfuscate and Beautify JS Code

Obfuscated JavaScript can hide logic behind dense symbols, packed functions, and encoded strings. This JavaScript Deobfuscator helps you turn messy, hard‑to‑read code into a clearer, reviewable format by unpacking common packers and applying safe, readable formatting. Use it to audit third‑party scripts, debug minified bundles, or understand code snippets before you run them.

The tool is designed for analysis workflows: you paste code, choose a strategy, and get a cleaned output you can copy or download. It does not execute your JavaScript; it transforms text so you can inspect it more confidently.

How It Works

Obfuscation exists on a spectrum. At one end, teams minify and bundle JavaScript to reduce payload size and speed up page loads. At the other end, attackers deliberately hide intent with layers of encoding, token substitution, and runtime decoding. In both cases, the practical problem is the same: you need a version that is readable enough to reason about. Deobfuscation helps you answer questions like “What does this script do?”, “Where does it send data?”, and “Does it modify the DOM in risky ways?”

Because JavaScript is highly dynamic, no single static tool can perfectly reverse every obfuscation method. That’s why this tool focuses on the highest-value transformations that work well across many snippets. You get immediate readability improvements, plus optional decoding for the kinds of literal hiding that commonly mask URLs, tracking identifiers, or command-and-control endpoints.

The deobfuscation pipeline combines detection, optional unpacking, and formatting. First, the tool scans your input for known obfuscation signatures such as “packer” wrappers, dense token substitutions, and common string encodings. Next, depending on the mode you select, it attempts to reverse those transformations. Finally, it beautifies the resulting code with consistent indentation and line breaks so you can read it like normal source.

What the tool does step by step

  • 1) Detect patterns: Looks for well-known wrappers (for example, Dean Edwards Packer style) and quick indicators like heavy use of escaped sequences or string-based decoding helpers.
  • 2) Transform text: Applies unpacking and decoding operations to produce an equivalent JavaScript string. These operations are conservative by default to reduce the chance of altering semantics.
  • 3) Beautify output: Adds whitespace, indentation, and line breaks around braces, semicolons, and control structures so the code becomes review-friendly.
  • 4) Provide actionable output: Returns the transformed JavaScript plus a short summary (what was detected, which steps ran, and how the output size changed).

Key Features

For modern build outputs, deobfuscation often starts with formatting. A clean structure makes patterns stand out: repeated function calls, suspicious string concatenation, and long switch statements used as control-flow flattening. Once formatted, you can quickly spot places where the code dynamically constructs a URL, reads cookies or localStorage, hooks event listeners, or injects hidden iframes. Even a basic beautify pass can turn a painful investigation into a straightforward review.

When the tool recognizes a packer wrapper, it attempts to restore the original tokens by replacing base‑N indices with the corresponding dictionary entries. This can dramatically reduce the noise of one-letter variables and encoded keywords. The result is still JavaScript, but it is closer to the author’s original structure, making subsequent analysis far more productive.

Unpack common “packer” obfuscation

If your snippet uses a packer-style wrapper that replaces words with base‑N tokens, the tool attempts to restore the original identifiers and reconstruct the script body. This is a frequent pattern in copy‑pasted “protected” widgets and older malware samples.

Beautify for readable diffs

Even when code is merely minified (not maliciously obfuscated), readability suffers. The beautifier inserts newlines and indentation, making it easier to compare versions, run code review, or annotate suspicious sections.

Optional aggressive string decoding

When enabled, the tool tries additional safe decoders for purely literal constructs such as atob('...'), unescape('%xx'), and simple String.fromCharCode(...) sequences. This can reveal URLs, keywords, and hidden messages that were split across numeric arrays.

Copy and download workflow

After deobfuscation, you can copy the output with one click or download it as a .js file for offline investigation, linting, or deeper static analysis in your preferred IDE.

Safe by design

The tool processes text only and never executes your JavaScript. That matters when you are inspecting unknown or suspicious code: you get readability improvements without running the script in a browser context.

Use Cases

  • Security review: Inspect third‑party tags, analytics snippets, and suspicious inline scripts before allowing them in production.
  • Incident response: Quickly unpack code found in compromised pages to identify beacons, skimmers, or credential theft logic.
  • Debugging: Turn minified stack traces into readable source so you can understand crashes and fix bugs faster.
  • Learning: Explore how packing and token substitution works by comparing input and output side by side.
  • Compliance and auditing: Keep readable copies of vendor scripts for documentation and change tracking.

In a typical security workflow, you might start by pasting a suspicious inline script from a webpage, then deobfuscating it to reveal hard-coded endpoints or stolen form fields. For performance work, you might paste a minified module and beautify it to track down an expensive loop or redundant DOM query. For product teams, readable output can also help you negotiate vendor changes by clearly showing what a third-party tag is doing.

Whether you are a developer diagnosing an error in a bundled file or a security analyst triaging a suspicious snippet, deobfuscation is usually the first step that makes all the next steps possible: searching, diffing, and reasoning about intent.

Optimization Tips

Start conservative, then escalate

Use “Beautify only” first if you suspect the code is merely minified. If you still see an eval(function(p,a,c,k,...) wrapper or heavy token substitution, switch to “Unpack” or “Unpack + Beautify”. Enable aggressive decoding only when your snippet uses literal encodings and you want to reveal embedded strings.

Validate output with static checks

After deobfuscation, run the result through a linter or formatter in your IDE. Static tools can highlight unreachable blocks, suspicious dynamic calls, and unsafe APIs. Deobfuscated code is far easier to scan for eval, Function, DOM injection, credential capture, and network beacons.

If you are dealing with malicious samples, consider copying the output into a dedicated analysis environment. Look for signs of data exfiltration (fetch/XHR to unfamiliar hosts), keylogging (event handlers on inputs), and skimming logic (capturing payment fields). Deobfuscated output makes these behaviors visible even without running the script.

Keep both versions for analysis

Save the original snippet and the output. When you find an indicator of compromise (IOC) like a domain or endpoint, it helps to show how it was hidden originally and how the tool revealed it.

FAQ

No. The tool treats your input as plain text and performs transformations like unpacking and formatting. It does not execute code in a browser or a sandbox.

The tool focuses on practical, common patterns: packer-style wrappers, minification, and straightforward literal string encodings. Heavily customized obfuscators may require specialized tooling.

Aggressive decoding is limited to simple literal constructs (like atob('...')) to reduce risk, but any transformation can affect formatting or edge cases. If accuracy is critical, keep the original and verify key sections.

Some obfuscators rely on complex runtime logic (dynamic property access, computed strings, anti-debugging) that cannot be fully reversed without emulation. In those cases, beautification plus manual review is often the right approach.

Copy the output into your editor, run a linter/formatter, and search for risky APIs, network endpoints, and DOM manipulation. For security work, document any domains, hashes, or indicators you discover.

Why Choose This Tool

The interface is optimized for speed: defaults are prefilled so you can test the tool instantly, and the result panel supports one-click copy and download. That means you can move from “I found a strange snippet” to “I have readable code and indicators” in a single pass. When you need more power, the output is a perfect starting point for AST-based tooling, sandboxed dynamic tracing, or manual refactoring.

This JavaScript Deobfuscator is built for quick, repeatable analysis. It provides a clean UI, sensible defaults, and practical transformation steps that cover the most common real-world cases without requiring browser execution. That makes it suitable for developers and security teams who need a safer first look at unknown scripts.

Because the tool emphasizes readability and conservative transformations, it helps you make better decisions: whether to trust a snippet, how to refactor minified code, or which parts of an obfuscated script deserve deeper investigation. Use it as the first pass, then escalate to dedicated reverse-engineering tools when needed.