JavaScript Obfuscator
Obfuscate JavaScript to make it harder to read, using real AST-based transformation.
Obfuscation makes code harder to read, not secure — anything that runs in a browser can still be inspected and eventually reverse-engineered; don't rely on this to hide a real secret (like the password check above, which is obfuscated but not actually protected). Runs entirely in your browser; nothing you type is sent anywhere.
Need the opposite? JS Minify Tool
What is JavaScript Obfuscator?
Paste JavaScript and get an obfuscated version, variable names mangled, structure rewritten, using a real AST-based obfuscation engine, not a naive find-and-replace that could easily break the code's meaning.
How to Use the JavaScript Obfuscator
- 1
Paste the JavaScript: Enter the source code you want to obfuscate.
- 2
Read the Obfuscated Result Instantly: Mangled, harder-to-read code with identical behavior appears automatically.
- 3
Copy and Test: Copy the result and test it before shipping, like any code transformation.
How It Works
The code is parsed into an AST first, rather than transformed with text-based find-and-replace, so the engine understands scope. It knows which identifiers are local variables safe to rename versus which are external references (like `window`, `document`, or an imported function) that must be left alone. Local variable and function names are replaced with short, meaningless identifiers, and string literals are commonly extracted into an array and referenced by index, making the source harder to skim even though it behaves identically.
Example
function greetUser(username) {
const greeting = 'Hello, ';
console.log(greeting + username);
}function _0x557e(_0x2300bc,_0x40abd4){_0x2300bc=_0x2300bc-0xd5;const _0x4f7c72=_0x4f7c();let _0x557e48=_0x4f7c72[_0x2300bc];return _0x557e48;}(function(_0x5794a3,_0x343c27){const _0x3466bf=_0x557e,_0x40fa3f=_0x5794a3();while(!![]){try{const _0x48e3df=parseInt(_0x3466bf(0xde))/0x1+parseInt(_0x3466bf(0xd8))/0x2+parseInt(_0x3466bf(0xdd))/0x3+-parseInt(_0x3466bf(0xd5))/0x4*(parseInt(_0x3466bf(0xd9))/0x5)+-parseInt(_0x3466bf(0xda))/0x6*(parseInt(_0x3466bf(0xdc))/0x7)+parseInt(_0x3466bf(0xe0))/0x8+-parseInt(_0x3466bf(0xd6))/0x9*(parseInt(_0x3466bf(0xdb))/0xa);if(_0x48e3df===_0x343c27)break;else _0x40fa3f['push'](_0x40fa3f['shift']());}catch(_0x30bce4){_0x40fa3f['push'](_0x40fa3f['shift']());}}}(_0x4f7c,0x375ac));function greetUser(_0x4b296c){const _0x374a0b=_0x557e,_0x8e1026=_0x374a0b(0xd7);console[_0x374a0b(0xdf)](_0x8e1026+_0x4b296c);}function _0x4f7c(){const _0x5b5f46=['Hello,\x20','572850BvVPSp','5rFblON','1724124iSSiBE','20nXLRAx','7UqbrFI','500691UzUXNS','144912DTjAvl','log','2215848KxFqsI','505428eAqqMm','1056474bRTzsz'];_0x4f7c=function(){return _0x5b5f46;};return _0x4f7c();}Identifier names and the string literal are mangled — the exact names shown will differ each time you run it, but the behavior is identical.
Common Use Cases
Making a client-side script harder to casually read in a browser's devtools, for example, deterring quick copying of a proprietary UI interaction or a puzzle/game's logic, without relying on a build step to do it.
Obscuring internal naming conventions in a script shared publicly, where the exact implementation isn't meant to be the takeaway.
Frequently Asked Questions
Common questions about JavaScript Obfuscator.