Online Javascript Obfuscator


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



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
Version 5.0 08/01/2009 Use POST variables for AJAX to increase maximum length

Relevant Links

Comments For This Page

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
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
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 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) {

or alert();
By Shripad K on 3rd March 2013
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
Good job. It obfuscates large js code with cirillic symbols fast and fine.
By Miclech on 15th January 2013
special chars problem "%u015E%u0130%u011E%u0131"
By musa on 1st January 2013
Best Tool , Great Job, supports HTML5 nicely
On 30th December 2012
doesn't fully obfuscate strings, there are other online js obfuscators that do
On 5th October 2012
Great tool
By Souvik on 21st September 2012
The filesize of my js has been greatly reduced, but I can't use this on scripts that incorporate dynamic PHP content. My php variables get obfuscated too. Any suggestions?
By o11y_75 on 18th September 2012
Great job!
By anand K on 18th September 2012
A brilliant tool. Thanks for sharing.
By Peter on 30th August 2012
thank you!
By r on 25th July 2012
A waste of time. Too easy to decode the obfuscated code. Simply replace eval by alert, document.write or something similar.
By rubendj on 25th June 2012
nice tool...
By Lawrence Bryant on 12th June 2012

30 out of 88 comments shown. See all comments.

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

Share This Page

Share this page with others using one of the methods below. Telling others about Daft Logic is good and we appreciate your support!