How to Safely Display Your Email Address Online Without Getting Spammed

If you have a website or blog, one of your motivating factors is that you’d like to promote yourself, your services or your ideas. Typically most bloggers don’t want to be writing anonymously and would like to provider their readership an easy way to contact them.

Unfortunately, it’s a really bad idea to let your email address set publicly on your website. There are all sorts of bots crawling across the web that download pages and use regular expressions to identify and collect email addresses that are sitting in plain-text on a website. If you do this, chances are you will soon be on the receiving end of a lot of unwanted spam.

Fortunately, there are several ways that you can allow people to contact you without displaying your email address in a way that would expose you to these types of spam-bots. An easy way would be to create an image with the text of your email address on it (that’s what Facebook does). 15 Days of JQuery suggests using AJAX to safely display your address. Some people don’t display their real address and just leave a contact form to allow people to send the messages. If you don’t protect your contact form, you’ll be on the receiving end of another type of spam. Some people obfuscate their email addresses on their sites so that spam-bots cannot read them, such as using name <at> example <dot> org instead of

All of these solutions have their pluses and minuses, but there’s a really simple solution that I’d suggest to you which will give the appearance of displaying your address in plain-text without exposing your email address to bots that harvest email addresses from the web. Since these types of bots generally cannot process JavaScript, using a simple JavaScript method to generate the text of your address should suffice to prevent the harvesting of your email address.

Here’s an example of how to do it:

<script language=”javascript” type=”text/javascript”>
var1 = “”; var2 = “na”; var3 = “me@exam”;
document.write(var2 + var3 + var1);

This will display as “” after being processed by JavaScript’s interpreter.

How do you protect your email address from getting spammed online? Let me know in the comments!


  1. I’ve been searching around for this type of blog entries . Will you post some more in future? I will be grateful if you will

  2. Alessandra says:

    This is great. Is there a way to make it a mailto link and still be spam-free?

Speak Your Mind