How can I encrypt JavaScript code so that it’s not decryptable?

The Javascript code is executed in the browser, i.e. on the client side, which means it must be available not-encrypted on the client side.

The “best” you can do is probably to minify it, which will make it harder to understand it — and a bit of obfuscation might do too — even if someone really motivated will still be able to read it.

See for instance the YUI Compressor, which can both minify and obfuscate JS code.

Leave a Comment