4 Ways to Hide Your Email Address from SpamBots

Spambots read your site like googlebot, and copy any email addresses they can find!

Spammers seem to be looking over your shoulder every time you’re online and its a full time job to keep your inbox clean. You steer clear of sites with questionable privacy policies, won’t leave your email address on forums and hide your email address on Facebook. But if you have a mailto: link on your Web site, your email address may be written for the whole world to see. Fortunately, there are a few tricks you can use to make it more difficult for the spambots to get your email address.

Spambots read Web sites hoping to find a mailto: link, then grabs the address that it links to and copies it to their database. But how can folks contact you if they can’t get your email address? Here are some solutions, from most to least difficult.

Note: All the code for these examples is in the source.

Forms, Forms, Forms

By far my first choice is a contact form. If done correctly (and it can surely be done wrong) a contact form hides your email address completely. The form sends the data gathered in the form to a script outside your Web page to be processed. Your site doesn’t display your email address, spambots can’t read it and with the use of forms, you can gather a lot of data about your site visitors. Another added benefit to forms is your site visitors can send you a message without a mail client like Outlook. They just fill in the form.

Online forms can be finicky and the data collected has to be cleaned and checked before it can be used, but the benefits are many and definitely worth the work.

Hide the email address with Javascript

Javascript code is read and executed after a Web site is downloaded, so Web code can be created on the fly that doesn’t exist as the spambot goes by. By using the “document.write” command, a live mailto: address can be written, then used as if it were in the code. Here’s an example:

. If you look at the page source for this part of the page, you’ll see a real mailto: link broken into chunks where a spambot will have trouble reading it. Then, after the page is loaded, these parts are re-assembled into a working mailto: link using javascript.

Hide the address with CSS styles

There’s a little used style in CSS (little used by those that read left to right) that will reverse the order of written text. By using this technique, an email address can be written backwards, then converted by CSS to render correctly. This doesn’t provide a clickable link, but the email address can be copy / pasted to an email client like Outlook. Here’s our example:

Create an image

Even Googlebot can’t read what’s in an image, so creating an image of your email address can be effective for hiding it from spambots, though this won’t last forever. In your favorite image software, Photoshop or GIMP for example, create an image of your email address, like this: The grid background makes it harder for the bots to decipher (they are getting smarter) but it can still be read by people.

Write it out

This technique is an old one and isn’t as effective as it once was. Spambots can be trained to read the modifications we make to hide the address. It involves writing out an email address phonetically. This isn’t a live address. It’s just text that when read aloud, will be the email address. It looks like this: someone (at) somewhere dot com. To hide an email better with this technique, add some text to the address that needs to be removed by your site visitors like this: someone (at) REMOVETHISsomewhere dot com.

The Downside

Many of these techniques don’t play well with screen readers (used by the visually impaired) and if you have javascript disabled, the javascript example won’t show an email address at all, so these techniques aren’t without their perils. Deciding which is the best fit for your Web site will be a personal choice and choosing one will depend on your technical expertise and your target demographic.

One of the most important aspects of a Web site is the ability to build a relationship with your site visitors, so going without some kind of contact form or mailto: link simply won’t do. There are other ways to hide your email address from spambots, many of them discussed in Sarven Capadisli’s post: Methods to hide email addresses from page source

View Comments

Leave a Reply