• Skip to main content
  • Skip to primary sidebar
Making Different

Making Different

Create, Learn, Build or Fix

  • Tech
  • Business
  • Relationship
  • Health
  • Travel
You are here: Home / Web Development / JavaScript / How to Convert HTML and CSS to Unreadable Javascript

How to Convert HTML and CSS to Unreadable Javascript

March 24, 2014 by Nitin Maheta

In one of my previous posts, I talked about Unreadable or Hide Your jQuery Source Code. So, now your jQuery code is fully protected; it will be the most challenging task for someone to know/understand your code.

But what about HTML and CSS?

Well, you can preserve your HTML and CSS codes, too, by converting them to unreadable javascript.

Once you convert your codes to unreadable javascript, you can use it on any HTML page, and no one will be able to find the actual CSS or HTML code through the page source of your HTML page. Firstly, select any HTML and CSS code that you want to convert to unreadable javascript.

Your HTML and CSS code should look like this:

<style type='text/css'>
.example {
background:#000000;
border: 1px solid #79D858;
width:400ox;
height:300px;
text-align:center;
}
.exampletexts{
font-size:36px;
color:ffffff;
}
</style>
<div class="example">
<div class="exampletexts">Example Texts</div>
</div>

Now, go to about.com’s HTML to Javascript converter page and paste your HTML and CSS codes together into textarea; click the “Convert” button, then immediately it will convert your code to Javascript that you can find another textarea box right below the convert button.

The converted javascript code will look like this:

document.writeln('<style type=\'text\/css\'>\n.example {\nbackground:#000000;\nborder: 1px solid #79D858;\nwidth:400ox;\nheight:300px;\ntext-align:center;\n}\n.exampletexts{\nfont-size:36px;\ncolor:ffffff;\n}\n<\/style>\n<div class="example">\n<div class="exampletexts>Example Texts<\/div>\n<\/div>');

So, we have converted HTML and CSS code to javascript, and now, we will need to convert javascript code to unreadable javascript code. We can do that using the Obfuscator tool. Go to the Js Obfuscator tool Website, paste the javascript code into the textarea box, then press the “obfuscate” button immediately. It will convert your javascript code to unreadable javascript code. Then all unreadable javascript code will look like this:

eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('d.c(\'<2 e=\\\'b\\/g\\\'>\\n.1 {\\h:#a;\\6: 5 7 #9;\\8:f;\\t:q;\\i-r:s;\\n}\\n.3{\\u-p:o;\\j:k;\\n}\\n<\\/2>\\n<0 4="1">\\n<0 4="3">l m<\\/0>\\n<\\/0>\');',31,31,'div|example|style|exampletexts|class|1px|nborder|solid|nwidth|79D858|000000|text|writeln|document|type|400ox|css|nbackground|ntext|ncolor|ffffff|Example|Texts||36px|size|300px|align|center|nheight|nfont'.split('|'),0,{}))

Now, add a javascript tag to the code and use it on any HTML page you like. I am repeating, don’t forget to add the javascript tag to the code. After adding javascript tag to the code, it should look like this:

<script type="text/javascript">
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('d.c(\'<2 e=\\\'b\\/g\\\'>\\n.1 {\\h:#a;\\6: 5 7 #9;\\8:f;\\t:q;\\i-r:s;\\n}\\n.3{\\u-p:o;\\j:k;\\n}\\n<\\/2>\\n<0 4="1">\\n<0 4="3">l m<\\/0>\\n<\\/0>\');',31,31,'div|example|style|exampletexts|class|1px|nborder|solid|nwidth|79D858|000000|text|writeln|document|type|400ox|css|nbackground|ntext|ncolor|ffffff|Example|Texts||36px|size|300px|align|center|nheight|nfont'.split('|'),0,{}))
</script>

Now your code is fully protected, and no one will be able to find out the actual HTML and CSS code, and it will be work ideally. One of the essential things is that you should save your HTML and CSS version as a backup because after converting the code to an unreadable one, you may restore it to the HTML and CSS version.



About Nitin Maheta

Nitin Maheta is editor in chief and webmaster of MakingDifferent Blog. You may reach him out on following social media:

Facebook | Twitter | Instagram

Primary Sidebar

Similar Posts

  • How to Prevent Embedding Website Inside An Iframe?
  • iFrame Generator – Free Online HTML iFrame Creator

Random Posts

santa claus putting presents under the tree

Why Christmas is celebrated?

By Nitin Maheta

congratulations-for-new-business

Congratulations Quotes and Wishes for New Business

By Nitin Maheta

hearing-loss

8 Celebrities Who Wear Hearing Aids

By Nitin Maheta

couple

Top 10 Mistakes Couples Make While Wedding Planning

By Priya Batra

net-neutrality

What is Net Neutrality and why it matters?

By Nitin Maheta

All categories | About us | Contact us | Privacy policy | Disclaimer | Write for Us | Dictionary | Sitemap

The owner of this site is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.

© 2025 Making Different