How to Stop Spam in Website Contact Forms

Contact form spam is usually sent by automated programs that find forms and submit them in bulk. You can stop most of it without annoying real visitors by layering a few quiet defenses: a hidden honeypot field, server-side checks, rate limits and a challenge only when something looks suspicious. No single measure is perfect, so combine them.
Why forms attract spam
Bots crawl the web looking for forms. Their goals include advertising, planting links, testing stolen data and using your form to send email to other people. Once a form address is known, it can be reused again and again. A form on a site with no protection may receive junk within days of going live.
Step 1: add a honeypot field
A honeypot is an extra field that real visitors never see, hidden from view with styling. Bots fill in every field they find. If the hidden field comes back with a value, the submission is spam and can be discarded. It costs visitors nothing and blocks a large share of simple bots. Make sure the field is also hidden from screen readers and from browser autofill, so real people do not fill it by accident. The accessibility side matters, as covered in the accessibility notes on alt text.
Step 2: check on the server, not only in the browser
Browser-side checks can be skipped by bots that post straight to your form address. Repeat all important checks on the server:
- Required fields are present and a sensible length.
- The email address looks like an email address.
- The message is not mostly links or a known spam phrase.
- The submission arrived after a realistic delay. A form submitted in under two seconds after loading was probably not filled by a person.
Step 3: limit how often one visitor can submit
Rate limiting stops floods. Allow only a few submissions per address per hour, and return a friendly message when the limit is reached. Many hosting services and form tools provide this setting. It also protects your mail account from being flooded.
Step 4: use a challenge when needed
Classic puzzles that ask people to pick traffic lights frustrate visitors and can be hard for people with disabilities. Newer options work in the background and score the visit, and show a challenge only if it looks suspicious. Choose a privacy-respecting one, read its data policy and mention it in your privacy page. If a challenge is shown, it should have an accessible alternative.
Step 5: change where messages go
Even good filters let a little through. A calm way to handle that is to deliver submissions somewhere with its own filtering, such as a private chat channel or a ticket inbox, and to keep a log. If your form sends email from your domain, make sure it is authenticated, otherwise your real enquiries may fall into spam too, as explained in the guide to SPF, DKIM and DMARC.
What not to do
- Do not publish your email address in plain text next to the form. Bots harvest addresses, so use the form only.
- Do not make real visitors solve hard puzzles for every message.
- Do not silently drop messages that might be real without any way for a person to see them. Keep a review folder for a while.
A layered setup that works for most small sites
- Honeypot field, hidden properly.
- Server-side validation and a minimum fill time.
- Rate limit per address.
- Invisible challenge for suspicious traffic.
- Delivery to a filtered inbox or chat, with a log you can review.
Test your form
After changing anything, submit a real test message and check that it arrives. Then try a submission with the hidden field filled in using the browser's developer tools, and confirm that it is rejected. Test on a phone as well, since a broken form is worse than a spammy one. Monitor the volume of junk weekly for a month, and tune the rules if real enquiries are being blocked. Keep the rest of your site hygiene in view too, see the website security basics.
Common mistakes
- Relying only on JavaScript checks.
- Using the same obvious hidden field name, such as "website", on every site.
- Forgetting to protect other forms, such as newsletter sign-up and comments.
- Making error messages that reveal exactly what failed, which helps bot authors.
- Never testing whether real messages still arrive.
A worked example
A small consulting site received about forty junk messages a day through its contact form, each promising cheap ranking services. The owner added a hidden field named something unremarkable, a two-second minimum fill time and a limit of three submissions per address per hour. The next day only two messages got through, and both were reviewed in a minute. A week later, one real client wrote in, and the message arrived normally. Nothing visible changed for visitors, and no puzzle was added. This kind of quiet setup is usually the best first move.
Reading the spam you receive
Look at the junk before you design defenses. Messages full of links point to link-planting bots, so a rule that rejects more than one link helps. Messages in a language you never use suggest filtering by language or by certain phrases. Identical text from many addresses indicates a campaign, and blocking by content works well. Messages with an empty body but a filled name often come from probing scripts. Each pattern suggests a specific rule, and a few sensible rules beat a heavy tool.
FAQ
Is CAPTCHA necessary?
Not always. A honeypot, server checks and rate limits stop most bots. Add an invisible challenge if spam continues.
Why am I getting spam even with a honeypot?
Some bots are smarter or are real people paid to submit. Add rate limits and content checks.
Will spam hurt my SEO?
Form spam does not appear on your pages, but spam in comments or guest areas can, because it adds bad links.
Can I just remove the form?
You can show an email address instead, but that attracts more spam. A protected form is usually better.
Should I delete spam or keep it?
Keep a short log for review, then delete it. Avoid storing personal data longer than you need.
Your next step: check which of the five layers your form already has, and add the cheapest missing one today, usually the honeypot.