JavaScript Obfuscator
Scramble and obfuscate JavaScript code to make it harder to read — variable renaming, string encoding, dead code injection
Scramble your JavaScript so variable names, string literals, and function calls turn into unreadable hex — the code still executes the same way, but anyone reading the source hits a wall of gibberish instead of your business logic. Pick which transforms to apply (variable renaming, string encoding, dead-code injection) and grab the output in one click. And everything runs in your browser. Nothing gets uploaded.
How It Works
The tool parses your code with an AST (abstract syntax tree) parser, identifies variables, function names, and string literals, then replaces them with randomized equivalents. String encoding wraps readable text in decode functions, and dead-code injection adds fake branches that never execute. The output is functionally identical but much harder to follow by eye.
Examples
Simple discount calculator
You’re protecting pricing logic in a client-side checkout widget.
function calcDiscount(price, pct) {
return price * (1 - pct / 100);
}
function _0xa3f1(_0x2b, _0x9c) {
return _0x2b * (1 - _0x9c / 100);
}
API key hidden behind string encoding
A quick demo — though you really should keep keys server-side. This just shows how string encoding works.
const endpoint = "https://api.example.com";
const token = "sk_live_abc123";
var _0xd4=atob("aHR0cHM6Ly9...");
var _0xe7=atob("c2tfbGl2ZV9...");
Game logic with dead-code injection
You built a browser game and want to make it annoying for cheaters to read your scoring system. Dead code adds misleading branches that never fire.
let score = 0;
function addPoints(n) {
score += n;
updateUI();
}
var _0x1a=0;function _0x4f(_0x8b){
if(false){console.log(_0x8b*2);}
_0x1a+=_0x8b;_0x3c();}
Who Uses This
Scramble client-side business logic before deploying to production so casual inspectors can’t just copy it.
Hide scoring algorithms and anti-cheat checks in browser-based games from players who open DevTools.
Distribute commercial JavaScript plugins where you want to discourage code theft without a full licensing server.
Create obfuscated JS challenges for capture-the-flag competitions or learn how obfuscation techniques work.
Common Mistakes
Obfuscation slows people down. It does not stop them. Never put API secrets, passwords, or encryption keys in client-side JS — obfuscated or not. Keep sensitive values on your server.
If your code is already minified, variable names are already short single letters. The scrambler won’t improve protection much and might break things. Obfuscate the readable source first, then minify the result.
Regex-based obfuscation can trip on edge cases — template literals, dynamic property access, or eval statements. Always run the scrambled version in a test environment before shipping it.
Technical Details
- Processing: 100% client-side — nothing leaves your browser
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Input: Limited only by your browser’s memory (tested up to ~500 KB of JS)
- Techniques: Variable renaming, string Base64 encoding, dead-code injection
- Output: Copy to clipboard or download as
.jsfile
Frequently Asked Questions
What is JavaScript obfuscation?
It’s the process of rewriting JS so it still works but is extremely hard to read. Variable names get replaced with random hex strings, readable text gets Base64-encoded, and fake code branches are mixed in. The browser executes it normally — a human reading the source gets a headache.
Can obfuscated JavaScript be reversed?
Yes, with enough effort. Beautifiers can reformat the code and someone patient can trace the logic. Obfuscation raises the cost of understanding your code — it doesn’t make it impossible. Think of it as a locked screen door, not a vault.
Does obfuscation slow down my website?
Barely. Renamed variables add zero overhead. String encoding adds a tiny decode step at runtime — we’re talking microseconds. Dead code makes the file a bit larger, but gzip compression mostly cancels that out. For 99% of sites you will not notice a difference.
Is this safe for production code?
This tool works great for simple to moderately complex scripts. For large production apps with dynamic imports, Webpack chunks, or heavy metaprogramming, you’ll want a dedicated build-step obfuscator like javascript-obfuscator that has deeper AST support. Always test the output before deploying.
Is my code uploaded anywhere when I use this?
No. Zero network requests are made with your code. The entire obfuscation process happens in your browser tab using JavaScript. You can disconnect from the internet and it still works perfectly. Your source code never touches a server.