JavaScript Obfuscator
Process code and structured data locally in your browser.
Process code and structured data locally in your browser.
Paste JavaScript and click Run. The page loads the open-source javascript-obfuscator library (version 4.1) and transforms your code with these settings:
_0x3a2f1c. Global names are left alone so code that other scripts call keeps working.Heavier options such as control-flow flattening, dead-code injection and self-defending code are off, because they can slow code down several times and break some scripts.
function greet(name) { return "Hello " + name; }
comes out as a line of the form function greet(_0x1b2c3d){var _0x4e5f=_0x2a1b;return _0x4e5f(0x0)+_0x1b2c3d;} plus the encoded string table. The output changes every run because names and the array order are randomised.
Obfuscation makes code harder to read and copy; it does not make it secret. Anything that runs in a browser can be stepped through in DevTools, and deobfuscators can undo much of the transformation. Never put API keys, passwords or business rules that must stay private in front-end code: keep them on a server. Test the obfuscated build before deploying, especially code that relies on Function.prototype.name or eval.
No. Minification removes whitespace and shortens names to make files smaller; obfuscation deliberately makes code harder to understand and usually makes it larger. Use the JavaScript minifier for size.
No. The library is downloaded from a CDN and runs in your browser; your code is never sent anywhere.