Online Javascript Obfuscator

Introduction

This javascript obfuscator is intended to be used as a resource to convert human readable javascript to a more shrouded code. This serves two purposes:

  • Makes it harder for others to copy and paste blocks of code
  • Reduces file size hence saves outgoing bandwidth for you and incoming bandwidth for your visitors

Input

Output

How it Works

Generally the code from the first textarea is copied into the second one.

Note : If you get errors with the output code, it may be because your source does not have semicolons (;) terminating each line.

Please report any bugs, fixes or suggestions to help make this tool better and remember, always keep the original code!

Remove Line Breaks

Loop through all lines in the text area. Looking at each line one-by-one, if a line has no semicolon at the end, add one and then join it to the line previous

Remove Comments

Loop through all lines in the text area. Looking at each line one-by-one, trim all white space from the line. Then check the fist and second characters in the line. If they are both forward slashes i.e. / , then remove that line.

Further Uses and Ideas

  • Detect variable names and rename them to something random
  • Detect function names and rename them to something random

Version History

Version Date Description
Version 1.0 9/06/2008 The Beginning
Version 2.0 09/06/2008 Simple Options ... Remove comments & Remove line breaks
Version 3.0 09/06/2008 Remove spaces option added ... Remove spaces & Fixed problem with semi-colon at end of line
Version 4.0 24/12/2008 adapt http://joliclic.free.fr/php/javascript-packer/en/
Version 5.0 08/01/2009 Use POST variables for AJAX to increase maximum length

Relevant Links

Comments For This Page

Awesome!!!
By Iman on 13th July 2021
Cool! Thnks!!!!!
By Dima on 21st December 2019
Best tool!
By MilkMan PRO(script dev) on 9th October 2019
loved it. used it for a couple projects . . . used other obfuscation methods and the used this to finalize it :D

On 19th September 2019
Not only obfuscated my code, it also made it marginally more lightweight. This tool is better than any other online obfuscator I've tested.
On 4th August 2019
Awesome! Very useful. Thanks a lot!
By WallyDanny on 27th April 2019
Great Job !!!
On 14th February 2018
Good job team, fine work!
By Miguel on 7th April 2017
I did never expect this!
On 1st April 2017
Great Work!
By Sistepa on 17th March 2017
Thanks
By Colombia on 25th January 2017
You had a bug when use a for loop like for(a=b;;) { c = d;} It will replace ;; by ;
By Nam Nguyen on 27th May 2016
T. Jaggar, thanks for the suggestion. We will look in to this,
By Daft Logic on 10th May 2016
I used this tool for some time now and really like it. I usually upload my scrips on our test environment, and when they work fine I compress them here and place the compressed version on preproduction then production. Based on my way of working, I was thinking of a great addition you could add to it: Allowing a special markup for sections that the tool should remove, and which it would do first. That would allow to have the script with some tracing or debug statements, yet ensure those are gone for prod. If, for example, it was removing all found between DEBUG and /DEBUG and , we could do code like this:
var x = someImportantStuff(); /* DEBUG */ console.log("result of important stuff is " x); /* /DEBUG */ continueNormalThings();
By T. Jaggar on 10th May 2016
D McLean, sorry this was the remnants of an older version of this page
By Daft Logic on 2nd February 2016
I do not see the checkboxes referred to in paragraph above:

"...numerous functions that each are triggered by the options/check boxes."
By D McLean on 2nd February 2016
Very Thankssss !!!!!!!!!!!!!
On 20th November 2015
goood
By names on 26th August 2014
Amazing Tool, Thanks a lot!
By s on 11th July 2014
Now this is awesome

On 20th January 2014
eval() function is insecure...
By security on 3rd December 2013
Great obfuscator, thank you very much!
By Bernat on 26th November 2013
Greate
By Tanzeel on 3rd November 2013
This is now removing spaces in string...?
On 10th September 2013
good tool but how we can download this tool.
On 18th August 2013
shield4j.com is an online Java bytecode obfuscator and encrypter
By Koka on 28th July 2013
Good But Not Best...........

By Musab Hussain on 13th March 2013
Absolutely sucks. De-obfuscated in seconds, literally:

just run :
for(var i in window) {
console.log(window[i]);
}

or alert();
By Shripad K on 3rd March 2013
saaas
On 15th February 2013
Pichabrava say:

Pichear bravos y bravas, libertad para vuestras pichas!

Good job team, fine work!
By Pichabrava on 22nd January 2013

30 out of 99 comments shown. See all comments.

Add your own comment below and let others know what you think: