About the JavaScript Obfuscator
This tool escapes every character of your script as a hex or Unicode sequence and wraps the result in eval(). The output runs identically, but the source is not readable without decoding. That is enough to stop casual copying of a snippet or to hide a string from a simple text search; it is not enough to stop anyone who wants the code, because the deobfuscator on this site reverses it in one click, and so will any browser console.
Real obfuscation tools rename identifiers, flatten control flow and split strings into arrays, and they still cannot prevent a determined reader from recovering behaviour, because the browser has to execute the code. If your goal is to protect a secret such as an API key, do not put it in client-side code at all.
The wrapper adds roughly three bytes per character, so obfuscated files are larger. Minify first with the JavaScript Minifier if size matters.
How to use
- Paste the script on the left.
- Copy the eval-wrapped output.
- Test it in the JavaScript Runner to confirm it behaves the same.
Common questions
- Is this secure?
- No. Anyone can decode it in seconds. Use it only to deter casual copying.
- Does eval make the code slower?
- Slightly, at startup. After the eval, the code runs at normal speed.
- Will Content Security Policy block it?
- A CSP without unsafe-eval will block eval. Check your site's policy before deploying.