Email obfuscation is the fix most small business sites are missing. If you list a plain email address like info@mybusiness.com anywhere on your website, bots are scraping it within days, and the flood of “your site has errors” spam and unsolicited SEO pitches never stops.
Here is what email obfuscation actually does, and how to set it up on your own contact page.
Why your inbox is full of garbage
Every time you write out an email address in plain HTML, like a mailto: link or just the text sitting on your contact page, it’s sitting there in the raw source code of your site. Bots crawl the web constantly looking for exactly that pattern: something@something.com. Once they find it, your address gets added to spam lists and sold around, and it never stops.
The tricky part is that removing the email entirely isn’t a great answer either. A lot of visitors don’t want to fill out a contact form. They want to see an address, copy it, and email you directly. So the real goal isn’t hiding your email from humans, it’s hiding it from bots while keeping it fully usable for people.
What email obfuscation actually does
Obfuscation means the email address never appears as plain text in your page’s source code. Instead, the page uses a bit of JavaScript to assemble the real address only in the visitor’s browser, after the page loads. A scraper reading your raw HTML sees scrambled fragments. A real person sees a normal, clickable email link.
Here’s a simplified version of the approach:
<a href="#" class="obfuscated-email" data-user="info" data-domain="mybusiness.com">Loading...</a>
<script>
document.querySelectorAll('.obfuscated-email').forEach(function(el) {
var user = el.getAttribute('data-user');
var domain = el.getAttribute('data-domain');
var email = user + '@' + domain;
el.href = 'mailto:' + email;
el.textContent = email;
});
</script>The address is split into two harmless-looking data attributes. Nothing in the source code reads as an email address. The script stitches it back together the moment the page loads, so visitors never notice a difference.
A few ways to do this
- JavaScript reassembly (shown above): the most common approach, works on almost any site, and keeps the link fully clickable
- Cloudflare’s built-in email obfuscation: if your site already runs through Cloudflare, this can be turned on site-wide with no code changes
- Click-to-reveal buttons: the mailto link is only built when a visitor clicks, so nothing sits in the page at all until then
- Written-out addresses (“info at mybusiness dot com”): zero setup, but it looks unprofessional and doesn’t stop every bot
For most small business sites, JavaScript reassembly or Cloudflare’s built-in option covers it without sacrificing how the site looks or works.
How to check it’s actually working
After setting it up, view your page’s source code (not the visual page) and search for your email address as an exact string. It should return zero results. Then open the live page normally and confirm the link shows the real address and opens your email client when clicked. If both of those check out, bots crawling your raw HTML get nothing usable, while real visitors see no difference at all.
Frequently asked questions about email obfuscation
Does email obfuscation stop all spam?
No single method is perfect, but it removes the easiest and most common way bots harvest addresses, which cuts scraped spam dramatically.
Will this affect my SEO?
No. Search engines don’t need to read your email address to index your page correctly.
Do I still need a contact form if I do this?
It’s worth keeping one as a second option, but you don’t have to rely on it. Many visitors still prefer emailing directly, which is exactly what obfuscation protects.
Stop the spam for good
At Sonoma Valley Web, we build and maintain websites for businesses in Sonoma, Glen Ellen, Kenwood, and across Sonoma County since 2005. If your contact page is leaking your email address to every scraper on the internet, that’s a five-minute fix. Get in touch and we’ll lock it down for you.