JavaScript obfuscation to protect its source code

JavaScript obfuscation to protect its source code

August 2013

Javascript is a scripting language, which implies that the source code is public and accessible to everyone, it is either interpreted or compiled by recent javascript engines such as Google Chrome's V8 engine. This mode of operation can be annoying when you want to protect your source code and intellectual property, to avoid having your code stolen by the competition, for example.

What is obfuscation?

There is a workaround that consists of making Javascript code extremely difficult to read and understand, so as to make reverse engineering very complicated, this technique is called obfuscation. Obfuscating code usually consists of doing this kind of processing:

  • Delete all comments
  • Remove the indentation from the code, as well as the carriage returns, we then obtain all the code on a single line, without any superfluous space
  • Renaming variables and functions, to give them an absolutely not explicit name like a, b, c, d...
  • Rewrite strings in hexadecimal

So, let's get back to our topic, there are many tools that allow you to minify and obfuscate JavaScript code, here is a quick tour of these tools:

Take a look at this page: excel condition color .

  • YUI Compressor [ link ]
    This tool was developed by Yahoo teams, who are also working on the YUI Javascript framework. It is currently the most used tool for minification and obfuscation of javascript, it was notably used for the production version of jQuery, before they decided to switch to the Closure Compiler.
  • Google Closure Compiler [ link ]
    The closure compiler was originally developed to make javascript code faster to execute and lighter to decrease loading time. This tool optimizes javascript code, removes unused code.
  • Javascript Obfuscator [ link ]
  • UglifyJS [ link ]
  • Jscrambler [ link ]
    It is not a tool but a service (SaaS), it is paying, but offers an excellent result, very difficult to decode.
  • Stunnix JavaScript Obfuscator & Encoder [ link ]

Deobfuscate JavaScript code

If it is possible to disgust javascript code to avoid having it stolen, we can also make obfuscated code more readable, this is called deobfuscation. There are tools like Revelo .

Take a look at this page: grunge logo with illustrator and photoshop .

James Smith

CEO / Co-Founder

Enjoy the little things in life. For one day, you may look back and realize they were the big things. Many of life's failures are people who did not realize how close they were to success when they gave up.


We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.