Skip to content
A contact form with email and message fields, a Cloudflare Turnstile check showing Success, and a Send button

Form spam on a static site: honeypot, Turnstile and rules ​

← All postsBootFormformsspamstatic-sitestutorial

In short: add the layers in order and stop when the spam stops. A honeypot (one hidden field) catches most bots for free and costs your visitors nothing. When bots start leaving hidden fields empty, add Cloudflare Turnstile, which is free and usually invisible. Keep IP blocklists, country restrictions and keyword rules for a sender or pattern you have actually seen.

Every contact form on a static site gets spam sooner or later, usually within days of going live. This post explains why, which layer stops which kind of bot, and how to add each one, with the exact HTML. The examples use BootForm, the form backend we build, but the honeypot and Turnstile work the same way with any backend that supports them.

Why static site forms get spam ​

A static site's form posts to a public address that anyone can send to. The form's action is in your page's HTML, so a bot that reads the page knows where to post, and after that it doesn't need your page at all. Most form spam comes from two kinds of bot:

  • Form fillers load your page, fill in every field they find and press submit.
  • Direct posters skip the page and send requests straight to the form's address, often in bulk.

A CAPTCHA alone stops both, but it adds a check for every visitor. A honeypot stops most of both for nothing, which is why it comes first.

The order that works ​

LayerStopsCost to your visitorsWhen to add it
HoneypotForm fillers and most direct postersNoneAlways, from day one
Cloudflare TurnstileBots that leave hidden fields emptyA check that is usually invisibleWhen spam gets past the honeypot
IP blocklistOne sender you have identifiedNoneWhen one address keeps coming back
Country restrictionTraffic from places you never serveBlocks real visitors there tooOnly for a site with a clearly local audience
Keyword rulesA pattern you have seen (a phrase, a link)Can catch real messagesLast, and with care

Each layer is independent, so you can combine them. Add one, watch for a week, and only add the next if spam still gets through.

1. Add a honeypot ​

A honeypot is a form field that real people never see and bots fill in. The backend treats any submission with that field filled in as spam. A backend can also require the field to be present but empty, which catches direct posters too, since they don't know the field exists.

On BootForm the field is called honeypot, and the honeypot is on by default for a form you create in the dashboard. Put this anywhere inside your <form>:

html
<!-- Spam trap. Real visitors never see it. Leave it empty. -->
<input type="text" name="honeypot" style="position:absolute;left:-9999px" tabindex="-1" autocomplete="off" aria-hidden="true">

Each attribute has a job:

  • position:absolute;left:-9999px moves it off-screen. Don't use display:none or visibility:hidden: some bots skip fields hidden that way.
  • tabindex="-1" keeps keyboard users from tabbing into it, and aria-hidden="true" keeps screen readers from announcing it.
  • autocomplete="off" stops the browser from filling it in for a real visitor.

Don't give the honeypot the name of a real field such as email or website. Every genuine message would then look like spam. And renaming it to something clever doesn't help: the bots that get past a honeypot are the ones that leave every hidden field empty, whatever it is called.

What a caught bot sees: on BootForm, the same "thanks, received" response as a real visitor, so it never learns it was caught. On your side the message goes to a Spam folder rather than your inbox, and it doesn't count against your monthly submissions. If a real message ever lands there, you can mark it as not spam.

If you send submissions from your own code (fetch, a script), include the field with an empty value. While the honeypot is on, a submission without it goes to spam.

2. Add Cloudflare Turnstile when spam gets past the honeypot ​

Some bots load the page in a real browser and leave every hidden field alone. Their messages arrive looking like real ones. That is the point to add a CAPTCHA.

Cloudflare Turnstile is a free CAPTCHA that usually needs no clicks. It checks the visitor in the background and only shows a challenge when something looks off. Cloudflare's free plan allows up to 20 widgets per account and unlimited checks, and it needs no credit card.

Step 1: create a widget. In the Cloudflare dashboard, open Turnstile, click Add widget, enter the domain your form lives on (your site, not your form backend's), keep Managed mode, and click Create. Copy the Site Key and the Secret Key. The secret is shown only once.

Step 2: give the keys to your backend. On BootForm: open the form, Settings, Spam protection, Cloudflare Turnstile CAPTCHA, Add, paste both keys and save. The secret key stays with the backend, never in your page.

Step 3: add the widget to the page. If you use BootForm's generated snippet, it already includes Turnstile once the keys are saved. If you wrote your own form, add Cloudflare's script and one <div> inside the form:

html
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>

<form action="https://f.bootform.com/11111111-1111-4111-8111-111111111111" method="POST">
  <input type="text" name="honeypot" style="position:absolute;left:-9999px" tabindex="-1" autocomplete="off" aria-hidden="true">
  <input name="email" type="email" required>
  <textarea name="message" required></textarea>

  <div class="cf-turnstile" data-sitekey="YOUR_SITE_KEY"></div>

  <button type="submit">Send</button>
</form>

A contact form with a Cloudflare Turnstile check under the message field, showing a green tick and Success

This is the widget in a demo page, using Cloudflare's test key (hence the "For testing only" line, which a real key doesn't show). Replace the example form ID with your own. The script turns the <div> into the widget and, once the visitor passes, adds a hidden cf-turnstile-response field to the form. A submission without a valid token is refused (on BootForm, 422 CAPTCHA_FAILED) and never stored. If you send the form with fetch() and new FormData(form), the token is included automatically.

Keep the honeypot on alongside Turnstile. It costs nothing and still catches the bots that fill everything in.

All four BootForm layers sit in one place, the form's Settings tab:

BootForm's Spam protection settings: a Honeypot switch turned on with the field name honeypot, a Cloudflare Turnstile CAPTCHA with its site key set, and empty IP blocklist and Country restriction sections

3. Rules for what you have actually seen ​

The last layers are blunt, so use them for a pattern you can point to in your submissions.

IP blocklist. If one address keeps sending junk, block it. On BootForm this is an exact match (blocking 203.0.113.5 doesn't block 203.0.113.6), and a blocked submission is refused before it is stored. Spam usually comes from many addresses, so this helps with a persistent individual more than a botnet.

Country restriction. Block a list of countries, or allow only some. It suits a local business that never serves visitors from elsewhere, and it is a poor fit for anyone with an international audience. Location comes from the visitor's IP address, which VPNs and mobile carriers can misplace. On BootForm a submission whose country can't be told is never rejected by this rule, and Tor counts as its own country (T1).

Keyword rules. Mark a message as spam when a field contains a phrase you keep seeing. They are the riskiest layer: a real customer can use the same word, and a message quietly sent to a spam folder is a message you never read. On BootForm, keyword rules are part of Form Rules on the Business plan, and a matching message goes to the Spam folder, where you can still check it.

For the same reason, BootForm never moves a message to spam by guessing from its content. Only the fixed rules do that: the honeypot and your own keyword rules. Instead, if a form's inbox starts to look like spam (links, repeats, bursts from one address), BootForm emails you once and the dashboard suggests Turnstile.

Mistakes that let spam in, or keep real messages out ​

  • Hiding the honeypot with display:none. Some bots skip it, so it catches less.
  • Deleting the hidden field while editing the page. It looks like a field someone forgot. A comment above it saying it is the spam trap stops you (or an AI agent) from "cleaning it up".
  • Posting through your own server. Per-IP limits and blocklists then see your server's address instead of each visitor's, so every visitor shares one limit. Post from the visitor's browser.
  • Starting with the strictest layer. A country block or keyword list on day one turns away real people before you know whether you have a spam problem.

Let an AI agent check it ​

If you use Claude Code, the bootform plugin in site-skills has a /bootform:fix-spam command. It reads the form's settings and a sample of recent messages, tells you what it found, and works through the same order as this post: honeypot first, then Turnstile. It asks before moving or deleting any message. Turnstile's keys stay in the dashboard, since the secret key should never pass through an agent. More in MCP and AI agents.

Frequently asked questions ​

Is a honeypot enough to stop form spam? ​

For many small sites, yes, at least at first. It stops bots that fill in every field and, when the field is required, bots that post straight to the form's address. Bots that run a real browser and leave hidden fields empty get past it; Turnstile is the answer to those.

Does Turnstile annoy real visitors? ​

Usually they don't notice it. In Managed mode it runs a check in the background and only shows a challenge, usually a single checkbox, when a visit looks suspicious.

Is Cloudflare Turnstile free? ​

Yes. Cloudflare's free plan allows up to 20 widgets per account with unlimited checks. On BootForm you use your own free Cloudflare keys, on every plan, including the free one.

Does spam count against my submission limit? ​

On BootForm, no. Messages the honeypot or a keyword rule sends to the Spam folder don't count, and messages refused by Turnstile, the IP blocklist or a country rule are never stored at all.

Can I use reCAPTCHA or hCaptcha instead? ​

Not on BootForm, which supports Cloudflare Turnstile only. Other form backends support other CAPTCHAs; our comparison lists what each one offers on its free plan.

Which of these are on BootForm's free plan? ​

The honeypot, Turnstile, the IP blocklist, country restrictions, the Spam folder and the spam alert are on every plan. Keyword rules (Form Rules) need the Business plan. Full details are in Spam protection and on the pricing page.