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(_0x471cf2,_0x4627e6){const _0x34bbf2=_0x548a,_0x256776=_0x471cf2();while(!![]){try{const _0x2116ca=parseInt(_0x34bbf2(0xac))/0x1+-parseInt(_0x34bbf2(0xae))/0x2*(-parseInt(_0x34bbf2(0xa4))/0x3)+-parseInt(_0x34bbf2(0xa7))/0x4*(parseInt(_0x34bbf2(0xa5))/0x5)+parseInt(_0x34bbf2(0xaf))/0x6*(-parseInt(_0x34bbf2(0xa6))/0x7)+parseInt(_0x34bbf2(0xaa))/0x8*(-parseInt(_0x34bbf2(0xad))/0x9)+-parseInt(_0x34bbf2(0xa9))/0xa*(parseInt(_0x34bbf2(0xa3))/0xb)+parseInt(_0x34bbf2(0xa8))/0xc;if(_0x2116ca===_0x4627e6)break;else _0x256776['push'](_0x256776['shift']());}catch(_0x5b5a4d){_0x256776['push'](_0x256776['shift']());}}}(_0x1103,0xb3442));function _0x1103(){const _0x327ec2=['Hello,\x20','680362zsUFau','1897218njuqpW','61898fxddzC','817998OsdGyI','8611823XtJINm','138kjjYKW','5761340KJYmsi','7GkBrPT','4EiRTTZ','10950648SAjCZf','10Qemmtg','8hahtfT'];_0x1103=function(){return _0x327ec2;};return _0x1103();}function _0x548a(_0x1ace26,_0x12f5aa){_0x1ace26=_0x1ace26-0xa3;const _0x11030e=_0x1103();let _0x548aa7=_0x11030e[_0x1ace26];return _0x548aa7;}function greetUser(_0x2fa029){const _0x50c2bf=_0x548a,_0x4c256d=_0x50c2bf(0xab);console['log'](_0x4c256d+_0x2fa029);}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.