JavaScript Obfuscator (Max)
A JavaScript obfuscator that runs in your browser on the javascript-obfuscator engine (the core behind obfuscator.io). Stack up to nine layers: minify, rename identifiers to look-alike X/x blobs, a base64 string array, split strings, control-flow flattening, dead code, self-defending code, object-key transforms and a final XOR wrap. Show Work lists every layer with its size before and after, and Verify runs both versions in a sandbox to compare their console output.
How to Use
- Paste JavaScript into the Input box: a whole module, a bundled file or a short snippet. The Input readout shows its size in bytes as you type.
- Tick the layers you want, or press Max Security for every layer except 7 (self-defending and debug protection). The Resistance readout updates as you tick.
- Press Obfuscate. The first press downloads the javascript-obfuscator engine and the Acorn parser from jsDelivr; after that they come from the browser cache.
- Read the Output and Growth readouts, then scroll to Show Work to see each layer’s size before and after.
- Press Verify to run the original and the obfuscated code in a sandboxed iframe and compare their
console.logoutput, then Copy or Download the .js file.
Worked Example
Split strings, then the string array. Layer 4 cuts every literal into 6-character chunks, so "Hello, world!" (13 characters) becomes "Hello," + " world" + "!", three pieces. Layer 3 then moves 75% of the strings into one shuffled, base64-encoded array and replaces each with a call such as _0x2f1c(0x1a), so the text no longer appears where it is used.
Rename and XOR. The engine names identifiers _0x1a2b3c (9 characters). Layer 2 swaps each for a 40–64-character blob of X (U+0058), x (U+0078), Х (U+0425) and х (U+0445). The Cyrillic two take 2 bytes each in UTF-8, so a blob averages 52 × 1.5 = 78 bytes. Layer 9 XORs the whole result with a 12–24-byte random key: H is 0x48, and 0x48 XOR 0x5A = 0x12. XOR is its own inverse, so 0x12 XOR 0x5A gives back 0x48 at run time. The scrambled bytes are base64-encoded at 4 × ⌈n ÷ 3⌉ characters, so 1,000 bytes become 1,336 characters and 9,000 bytes become 12,000.
The common mistake: turning on layer 7 for code you still need to debug. Debug protection re-arms a debugger trap every 4,000 ms while DevTools is open. Self-defending code also stops working once it is reformatted, so pretty-printing it to read a stack trace breaks it. That is why Max Security leaves layer 7 off: the default set scores 4 + 12 + 22 + 6 + 18 + 10 + 14 = 86/100, and adding layer 7 for production only raises it to 94.
Show Work
The Nine Layers
A Short History of Obfuscation
Writing deliberately unreadable code is older than the web: the International Obfuscated C Code Contest has run since 1984. Christian Collberg, Clark Thomborson and Douglas Low wrote the first systematic taxonomy of obfuscating transformations in 1997, at the University of Auckland. They sorted the techniques into layout, data and control transformations, and the layers here fall into the same groups: rename is layout, the string array is data, and flattening is control. Control-flow flattening itself is usually credited to Chenxi Wang’s 2000 thesis at the University of Virginia.
In 2001 Boaz Barak and six co-authors proved that a perfect “virtual black box” obfuscator cannot exist in general. Obfuscation can raise the cost of reading code, but it can never make reading impossible. The javascript-obfuscator engine used here was started by Timofey Kachalov in 2016 and also powers obfuscator.io. This page loads version 4.1.0 and adds two passes of its own: the look-alike rename and the XOR wrap.
About This Tool
This tool runs the javascript-obfuscator engine with settings tuned to be safe: strings and control flow at 75% rather than 100%, base64 rather than RC4, and object keys off by default. It then adds two passes of its own. The rename pass parses the output with Acorn and changes only real identifier nodes, so _0x text inside strings is left alone. The XOR wrap leaves no readable eval, atob or globalThis names, because each one is built from character codes at run time. Verify runs both versions in a sandboxed iframe and compares their console output.
Everything runs in your browser. The only network requests are the two library downloads on the first Obfuscate, and your code is not sent with them.
It is for developers who ship client-side code, for people building reverse-engineering challenges, and for anyone who wants to see what each obfuscation layer actually costs.
Related tools: Python Obfuscator, Minifier / Beautifier, and Unicode Lab.
Frequently Asked Questions
Does my source code leave the page?
No. The first Obfuscate downloads two library files from jsDelivr, javascript-obfuscator 4.1.0 and the Acorn 8.11.3 parser. Your code is never sent with that request: every layer runs inside your tab, and Verify runs in a sandboxed iframe on the same page.
Can obfuscated JavaScript be turned back into readable code?
Yes, with enough effort. In 2001 Barak and six co-authors proved that no obfuscator can hide everything a program does. The browser has to be able to run the result, so the XOR key and the string-array decoder ship inside the same file. Obfuscation makes the code slow and tedious to read; it is not encryption. Passwords and secret keys belong on a server, not in code you hand to a browser.
Why is the output so much bigger than the input?
Each layer adds bytes. The engine names identifiers like _0x1a2b3c (9 characters), and layer 2 replaces each one with a 40–64-character blob of X, x, Х and х. The two Cyrillic letters take 2 bytes each in UTF-8, so a blob is 60–96 bytes, 78 on average. Base64 in the XOR wrap turns every 3 bytes into 4 characters, and dead code fills 40% of blocks. The Growth readout shows the total multiple, and Show Work breaks it down by layer.
What does control-flow flattening do?
It rewrites a run of statements as a while loop around a switch. A shuffled string of case numbers decides which statement runs next, so the order can no longer be read from top to bottom. This tool flattens 75% of eligible blocks, not 100%, because flattening every block runs into engine bugs around try/catch and async/await. The cost is speed: tight loops can run noticeably slower.
Will obfuscation break my code?
Usually not, but three things are known to break it. Code that reads its own source through Function.prototype.toString, code that relies on function.name, and code that uses eval to reach local variables can all fail. Layer 8 (object keys) is off by default because it can break spread and destructuring. Verify runs both versions for up to 5 seconds each and reports whether their console output matches.
How do I use the JavaScript Obfuscator (Max)?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Does it cost anything or need an account?
No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.
Is anything I type uploaded?
No. The tool works entirely on your device, so the values you enter never leave your browser.
Common Use Cases
Ship a commercial widget
The default 7 layers score 86/100 on the resistance scale before the code goes to customers.
Build a reverse-engineering puzzle
Stack all 9 layers (100/100) for a CTF challenge that takes real effort to unpack.
Harden a minified build
Add rename and string array (12 + 22 points) on top of a bundle that is already minified.
Learn how obfuscators work
Toggle one layer at a time and compare sizes in Show Work: the rename pass alone can multiply short code several times.
Check the cost of each layer
The Growth readout shows the size multiple, for example ×2.00 when 4 KB of code becomes 8 KB.
Last updated: