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
If 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/2010Question: if I have a function called initialize() that I want to run on onLoad()...how do I call it after the code is obfuscated? Thanks
By Victor on 08/07/2010Genius! I'm a loser with this stuff, and it even worked for me.
By Stefan on 07/07/2010This obfuscator is awesome! I use it to obfuscate HTML code, so search engines or content grabbers will hardly read it. Example:
document.write('Hidden HTML');
This works like a charm! Thanks a lot!
On 13/06/2010Thanks! I use it daily, whenever making modifications to existing scripts.
By Aulo Aasmaa on 10/06/2010I Love it
By Asif Ashraf on 24/05/2010Hello, good job, but a little remark.
Anybody that gets the obfuscated JS, and replaces "return p" by alert(p) or something else to write inside a textarea for example will gets the full original source code.
I was doing it in less than 2 minutes after regarding the obfucated code.
That's not very usefull...
By XCoronner on 12/05/2010hello sir i am doing the project on java script obfuscator. so your guidance may help me.
By prasanth on 21/03/2010used as always great! if it does not work for you the close browser, clear all cache and re-open.
By martin@maitechnology.com on 08/02/2010very very good. works like a clock.
On 02/02/2010A very.very.very....... (up to infinity)
great job I have ever saw.
A very great help
Thanks a lot.
By Amin on 29/01/2010perfect - just what I wanted. x
By Martin on 13/01/2010Excelent work! Just what I was looking for for some while! Keep it up!
By Andrei on 06/01/2010Does not work
On 04/12/2009Its simply best. Those who are complaining, I am certain, they are not properly doing it. Ppl, please only put the code in here, not the html tags.
By rlsking.com on 05/11/2009Awesome! It works perfectly.
By Dh on 02/11/2009does this handle Function object?
On 23/09/2009Why should anyone have to obfuscate their code. Didn't you learn by reading someone else's code?
By javabeans on 26/08/2009I'm afraid it didn't work for me, like every other obfuscator I've tried.
By Buchow on 02/08/2009works great!!
i'd love to see the source
thanks
On 06/05/2009I used a java script. this creates an output but the browser simply displays the obfuscated code when click on the html. hence, this thing does not reallt work for me.
write to me: mannharleen@gmail.com
By harry. on 13/04/2009works great!!!
On 27/03/2009No luck -- the text which was output is not readable by a browser.
By Don on 23/03/2009It works efficiently, clean output, thanks
By Ken on 13/01/2009Please clear your internet cache and try again.
By Daft Logic on 08/01/2009it's not working
i'm usinf ff and ie even g chrome
On 08/01/2009this sucks big time, barely leaves 20% of a 8kb sized JS..
On 21/12/2008
Add your own comment below and let others know what you think: