JavaScript Obfuscator

Process code and structured data locally in your browser.

How it works

Paste JavaScript and click Run. The page loads the open-source javascript-obfuscator library (version 4.1) and transforms your code with these settings:

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.

Example

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.

What obfuscation can and cannot do

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.

FAQ

Is obfuscation the same as minification?

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.

Is my code uploaded?

No. The library is downloaded from a CDN and runs in your browser; your code is never sent anywhere.