Skip to main content Accessibility Feedback

Preventing email spam without using a lame contact form

Contact forms suck. But so does the email spam that happens when you post your raw email address on your website.

Fortunately, there’s a really easy way to make that go away.

Encoding your email address #

Encode your email address into character entities. This transforms an email like into

This renders as a readable characters to your visitors (including those with screen readers), but looks like gibberish to a spam bot.

It’s not just for email, either. You can encode phone numbers, too.

There’s a free online tool you can use. If you’re a WordPress user, you can also use their native antispambot() method. I wrote a plugin for using it in the text editor.

🚀 Make 2018 the year you master JavaScript! My pocket guides and mini courses are short, focused, and made for beginners. You can do this!

Have any questions or comments about this post? Email me at or contact me on Twitter at @ChrisFerdinandi.

Get Daily Developer Tips