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 fist textarea is copied into the second one. In between that here are numerous functions that each are triggered by the options/check boxes. So if none of the checkboxes are on, there will be no change in the code.
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 1 (09/06/2008) - The Beginning
- Copy Input to Output (no changes)
Version 2 (09/06/2008) - Simple Options
- Remove comments
- Remove line breaks
Version 3 (24/12/2008) - Remove spaces option added
- Remove spaces
- Fixed problem with semi-colon at end of line
Version 4 (24/12/2008) - adapt http://joliclic.free.fr/php/javascript-packer/en/
Version 5 (08/01/2009) - Use POST variables for AJAX to increase maximum length
Relevant Links
- wikipedia article on Obfuscated code
- Packer JavaScript en PHP
Previous Comments For This Page
Great tool!
By Alexandru Bagu on 12/01/2012OUTSTANDING - THANK YOU!
On 04/01/2012Excellent Work guys!! Thanks a lot!
By Israel Ortega on 28/12/2011good work
By saintush on 19/12/2011Best javascript obfuscator I have used.
Cut a 44770 byte file to a 23858 byte file!
That's nearly half the file size, the script runs faster now :)
By Con on 17/11/2011Great! is very interesting and useful
By undest on 16/11/2011TnX veRy Go0D
By Amir Mansouri on 05/11/2011simply superb, this rocks! best way to deter copiers a tad bit too long.. (i am one :D )
On 16/10/2011When code uses stings vars like
var str = "some text" somevar or function call
"some text"
"some text";
output code rises error "missing ; efore statement".
On 11/10/2011great job this is amazing great great great awesome work thank you very much.!!
100
By richy on 03/09/2011Found this:
http://www.cloudcomputingetc.com/2011/08/javascript-code-protection-compression.html
By Jinna on 02/08/2011I tried to parse 8000 lines of javascript and it does not work :( But i love your tool tho.
By unagi on 30/07/2011excellent project. moreso for bandwidth saving and also validation than anything else. If it doesn't work, it's usually an omitted semi-colon or something simple like that. easy enough to decode means easy enough to spot errors. I use it on every prject - tkank you folks!
On 29/06/2011Woah, sooooo good ! BRAVO
By Nehat on 24/06/2011Not working for all JSs
On 21/05/2011replace first eval with "document.write" and obfuscation is gone :(
On 21/02/2011Excelnt job! (if it works, of course. Didn't test it yet).
By Jambo Joe on 12/02/2011awsome!
By doug on 11/02/2011I use this on a daily basis. It's a great tool. I run all of my JS through it. Thanks for keeping this tool alive!
By Charles Watkins on 31/01/2011Thanks for making this!
By Unagi on 28/01/2011one of the most helpful little hacks i have ever used
On 31/10/2010THANK YOU!
By Boogie on 23/10/2010Mozilla Firebug can easily translate it back to the readable JS code.
By pozirk on 28/09/2010it can not be readable by human. so then what is the usefull. if the generated code is not readable by browser then its fine.
On 25/08/2010Replace "eval" with "alert" .. no comment
On 24/08/2010Obfuscation is not protection nor compression.
http://www.jssob.net/
By Vincent G on 22/08/2010@ XCoronner, Tsunamy_boy, Awesome Finding buddy.I never thought it would be as simple as this!!
If it is so easy to decode then wats the need to obfuscate i dont get it!
On 09/08/2010If you have Firefox with the web developer add-on just click on View Generated Source it shows you the HTML.
On 27/07/2010unfortunately this is easy to revert, just user "alert" instead of "eval".
but thanks for help and for shearing : )
By Tsunamy_boy on 16/07/2010khem... pretty useless if you REALLY need to obfuscate your code... Anybody can just copy this 'obfuscated' code from my site to local machine, create empty html, paste this code, replace 'eval' with 'alert' -and wow- my original javascript in messagebox.
By sander on 09/07/201030 out of 56 comments shown. See all comments.
Add your own comment below and let others know what you think: