How to Hide Email Addresses from Spammers

One way spammers get email addresses is by writing programs that crawl around web pages, harvesting them from message boards and the like... pretty similar in fact to the way search engines like google harvest web pages to index them.

So, how do you hide your emaill address from spammers?

1. A Simple Way

Just change it so that programs can't find it, but people can easily work out what you mean.

andrew.murphy _at_ example _dot_ com
andrew.murphyNoSpamPlease@example.com

2. Use Some Simple Javascript

This breaks your email address into 2 seperate pieces, and it used to be pretty foolproof. Unfortunately, people also used this trick to fool Google, so Google 'runs' the javascript on webpages first before indexing them, thus exposing your hidden email address.

This would be too hard for spammers to do, so they simply query Google for domain names ... and thus get email addresses that way.

<script language=javascript> 
<!--  
var username = "andrew.murphy"; 
var domain   = "example.com"; 
document.write(	
	"<a href=\"mai" ."lto:" + username + "@" + domain + "\">" + 
	username + "@" + domain + "</a>"); 
//-->
</script>

You can use VIEW>SOURCE to see how this works.

3. Use HTML Enoding

According to a little known part of the HTML specification, plain text can be encoded using hexidecimal ASCII codes: A=&#x41; B=&#x42; C=&#x43; ...

And text inside URL's can be encoding as follows: A=%41 B=%42 C=%43 ...

Put it all togther, and using some javascript, we can generate hidden email addresses. Use View>Source to check how this is done, and to check that I am not harvesting your email address!

Email Address:
Hint: You can enter your email as: Andrew Murphy <Andrew.Murphy@example.com>

HTML for a simple email address

HTML for a <a href=mailto: > tag

HTML for <a href=mailto: > tag, with escaped name.

This method is pretty safe, but there is 1 problem - Google (and other search engines) converting your obscured email address back into plain English, and then indexing it.

There are 3 ways round this.

  1. Using the no cache tag <meta name="robots" value="nocache">
  2. Using the middle option above, i.e. with your email address only inside the URL.
  3. Splitting up your email address by using HTML, e.g. comments, table cells, etc.

© 2005 Andrew Murphy • All Rights Reserved