Bots fill public signup forms for several reasons: to pad lists with fake addresses, to probe for forms that send a confirmation email to any address, to push spam links through a name field, or to cause harm to third parties by making your form email a victim. The result is bounces, complaints, wasted sends and, in the worst case, damage to your sending reputation.
No single control stops all bots. The effective approach is layered: a honeypot field and a time check to catch simple bots cheaply, a challenge such as Cloudflare Turnstile or another CAPTCHA for the rest, rate limits on the server, and double opt-in so that an address only receives marketing mail after its owner confirms. This guide compares the options and gives code you can adapt.
What bot signups cost you
- Bounces and invalid addresses from made-up emails, which hurt reputation. See bounce rate.
- Spam trap hits if bots submit scraped or typo addresses.
- Complaints from real people whose addresses were entered by a bot and who then receive a message they never asked for.
- Sending cost and noise in your analytics.
- Abuse of your form as a relay for unwanted messages. See email bombing and subscription bombing.
The options compared
| Control | How it works | Strengths | Weaknesses |
|---|---|---|---|
| Honeypot field | A hidden field that people never fill but naive bots do | Free, invisible, no friction | Defeated by bots that render the page or skip hidden fields |
| Minimum fill time | Reject a submission that arrives faster than a person could type | Free, invisible | Easy for a bot to wait; needs a signed timestamp |
| CAPTCHA (reCAPTCHA, hCaptcha) | Challenge or risk score verified on the server | Strong against many bots | Friction, privacy and accessibility concerns, third-party dependency |
| Cloudflare Turnstile | Challenge that is usually invisible, verified on the server | Low friction, often no puzzle shown to the visitor | Third-party dependency; confirm current terms and limits |
| Rate limiting | Cap submissions per IP, address and form | Stops floods | Attackers rotate IPs; limits can affect shared networks |
| Double opt-in | Send a confirmation message and wait for a click | Removes fake and mistyped addresses, proves consent | Does not stop the confirmation email being sent to a victim by itself |
| Address validation | Check syntax, domain, MX and disposable domains | Catches obvious junk | Cannot prove the person owns the address |
Layer 1: a honeypot and a time check
A honeypot is an extra field that is hidden from people with CSS and removed from keyboard navigation and assistive technology. A bot that fills every field reveals itself. Do not use display:none alone as the only technique if you can avoid it, since some bots skip such fields; positioning the field off screen works better. Give it a plausible name and turn autocomplete off.
<form method="post" action="/subscribe">
<label for="email">Email</label>
<input type="email" id="email" name="email" required autocomplete="email">
<!-- Honeypot: people never see or fill this -->
<div style="position:absolute;left:-9999px" aria-hidden="true">
<label for="website">Leave this field empty</label>
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
</div>
<input type="hidden" name="ts" value="{{ signed_timestamp }}">
<button type="submit">Subscribe</button>
</form>On the server, reject if the honeypot has a value or if the signed timestamp shows a submission in less than about two seconds. Return the same success message either way so the bot learns nothing.
// Node.js (Express) example
const crypto = require('crypto');
const SECRET = process.env.FORM_SECRET;
function sign(ts) {
return crypto.createHmac('sha256', SECRET).update(String(ts)).digest('hex');
}
app.post('/subscribe', (req, res) => {
const { email, website, ts, sig } = req.body;
const age = Date.now() - Number(ts);
const valid = sig === sign(ts) && age > 2000 && age < 3600 * 1000;
if (website || !valid) return res.json({ ok: true }); // silent drop
// continue with validation, challenge check and confirmation email
});Layer 2: a verified challenge
A challenge widget produces a token in the browser. The token is worthless until your server sends it to the provider for verification. Never trust a token that has not been verified server-side, and never place the secret key in front-end code. Cloudflare Turnstile is one option; reCAPTCHA and hCaptcha work in the same way with different endpoints. Check the provider's current documentation for setup, limits and terms.
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<form method="post" action="/subscribe">
<input type="email" name="email" required>
<div class="cf-turnstile" data-sitekey="YOUR_SITE_KEY"></div>
<button type="submit">Subscribe</button>
</form>curl -s https://challenges.cloudflare.com/turnstile/v0/siteverify \
-d "secret=$TURNSTILE_SECRET" \
-d "response=$TOKEN_FROM_FORM_FIELD_cf-turnstile-response" \
-d "remoteip=$CLIENT_IP"
# Response is JSON. Accept the submission only when "success" is true.The same pattern applies to reCAPTCHA (token in g-recaptcha-response, verified at its siteverify endpoint) and hCaptcha (token in h-captcha-response). Tokens are single use and expire quickly, so verify when the form is submitted and handle a failure by asking the visitor to try again. Provide an accessible alternative where required, and mention the challenge provider in your privacy information.
Layer 3: rate limits and validation on the server
- Limit per IP and per address. For example, a handful of submissions per IP per hour and one confirmation email per address per period. Pick numbers that fit your traffic.
- Limit confirmation emails to the same recipient. This stops your form from being used to flood one inbox.
- Validate the address. Check syntax, domain existence and MX, and consider rejecting known disposable domains. See detecting disposable addresses and validation before sending.
- Reject unexpected fields and oversize input. Strip newlines from fields that could reach a mail header. See header injection.
- Log and alert. A sudden spike in signups with similar patterns is a signal worth an alert.
Layer 4: double opt-in
Double opt-in means a new subscriber is added to your sendable list only after clicking a link in a confirmation message. It removes typos and addresses entered by bots for other people, and it records proof of consent. It is the main defence against polluted lists, but not a substitute for bot protection, because the confirmation email itself is sent to whatever address was submitted. Keep that message plain and short, include a clear note about who requested it and expire the link after a sensible period. See how to set up double opt-in and the signup form guide.
Measuring whether it works
Protection is only useful if you can see its effect. Track the share of submissions rejected at each layer, the confirmation rate (confirmed signups divided by confirmation emails sent), the bounce rate of confirmation emails and the number of complaints that mention a signup you did not make. A healthy form has a high confirmation rate and a very low bounce rate on confirmation mail. If the confirmation rate falls while submissions rise, you are probably being targeted. Review the data weekly during an attack and monthly otherwise, and adjust limits gradually so that you do not lock out real visitors on shared networks such as offices and mobile carriers.
Choosing a combination
| Situation | Suggested setup |
|---|---|
| Small blog newsletter, light traffic | Honeypot, time check, validation and double opt-in |
| Growing list with occasional bot waves | Add Turnstile or another verified challenge and per-IP limits |
| Under active attack | Challenge on every submission, strict per-address limits, temporary pause of confirmation emails to new domains |
| Accessibility is a priority | Prefer low-friction challenges, provide an alternative, and rely on honeypots, rate limits and double opt-in |
| No control over the front end | Put protection at a proxy or the form handler, and verify on the server |
Troubleshooting
| Problem | Likely cause | What to do |
|---|---|---|
| Bots still get through | Server does not verify the token, or the form endpoint is called directly | Verify the token on the server for every submission and require it |
| Real users are blocked | Honeypot filled by autofill, or time check too strict | Name the honeypot field unlike common autofill fields and relax the minimum time |
| Challenge fails for some visitors | Blocked scripts, strict privacy settings, expired token | Show a clear retry message and an alternative path |
| Confirmation emails bounce a lot | Fake addresses still reaching the sender | Add validation and per-domain limits, review the bounce reasons |
| Complaints about unsolicited confirmation mail | Victims of third-party submissions | Tighten limits, add a challenge and keep the message clearly worded |
Start with the cheap layers, add a verified challenge when bots persist, and keep double opt-in as your safety net. Review the numbers regularly: confirmation rate, bounce rate and the share of submissions rejected at each layer tell you which control is carrying the load.
Protect your sender reputation Suppression of hard bounces and complaints, plus webhooks for every delivery event.
References and further reading
Frequently asked questions
What is the best way to stop bot signups?
Use layers: a honeypot and time check, a server-verified challenge such as Turnstile, rate limits and double opt-in.
Does a honeypot field stop all bots?
No. It stops simple bots that fill every field, but more capable bots skip hidden fields, so add a verified challenge.
Is Cloudflare Turnstile better than reCAPTCHA?
It is usually less intrusive for visitors, but both work the same way with server-side verification. Compare current terms, privacy and limits.
Does double opt-in prevent bot signups?
It keeps unconfirmed addresses off your list, but the confirmation email is still sent, so you also need bot protection and rate limits.
Why must I verify the CAPTCHA token on the server?
Because a bot can post to your endpoint directly. Without server-side verification the token proves nothing.