prevent form spam
How to Prevent Form Spam on Your Website or App
Stop form spam with layers: honeypot, time check, rate limit, content filter, then reCAPTCHA or Turnstile only if needed. Setup steps and v2 vs v3 explained.

The best way to prevent form spam is to stack cheap, invisible checks first and add a CAPTCHA only if spam still gets through. A hidden honeypot field, a minimum fill time, a rate limit and a server-side check stop most bots without asking a real visitor to prove anything. WebsitePublisher is a full-stack AI web platform, so forms, email and data for your websites and apps live in one built-in backend. That means these checks can sit on the server, where bots cannot skip them.
This guide covers each layer in order, how to set up Google reCAPTCHA if you decide you need it, how v2 and v3 differ, and what to do about the spam no bot filter catches.
TL;DR
- Start with invisible layers: a honeypot field, a minimum fill time and a rate limit. They cost your visitors nothing.
- Add a CAPTCHA (reCAPTCHA, Turnstile or similar) only when spam keeps arriving. Always verify the token on the server, never only in the browser.
- Honeypots and CAPTCHAs cannot stop a person typing spam by hand. Use content checks and a review folder for that.
- On WebsitePublisher, your AI assistant (ChatGPT, Claude, Gemini, Mistral, Cursor and others) builds and publishes your websites and apps through the WebsitePublisher connector, and every change is live immediately.
Table of Contents
- Where form spam comes from
- Layer 1: a honeypot field
- Layer 2: a time check
- Layer 3: a rate limit
- Layer 4: content checks and a review folder
- Layer 5: a CAPTCHA, only when the first four are not enough
- Which layer for which problem
- What it looks like on WebsitePublisher
- Our view: protect the visitor first
- Build the form and its protection with your own AI assistant
- A short checklist before you launch
- FAQ
- Sources
Where form spam comes from
Form spam has two sources, and each needs a different defense.
Bots. Scripts crawl the web, find forms and post to them. Some fill every field they see. Some skip your page entirely and send data straight to the form’s endpoint, the address the form submits to. They are cheap to run, so volume is high.
Humans and hybrids. Real people, or bots routed through solver services, type promotional messages into your contact form. Visible CAPTCHAs can be solved by machine learning or outsourced to human solver services for a fraction of a cent per solve, which is why they work best as a last step rather than a primary defense.
Knowing which kind you get tells you which layer to add. Open a few spam entries. If they are random strings, filled fields in odd orders or dozens per minute, it is bots. If they are readable sales pitches with a link, someone typed or pasted them.

Layer 1: a honeypot field
A honeypot is a form field that real visitors never see. Bots read the page code, spot the field and fill it. Any submission with that field filled is spam.
Honeypots are cheap, catch a large share of simple bots and are invisible to legitimate users. That is why they are the first layer to add.
A few details decide whether yours works:
- Give the field a meaningless, ordinary name. Avoid names like “email” or “phone”. A browser or password manager may autofill them for a real visitor, and that message would then be dropped without anyone noticing. Set autocomplete to off on the field.
- Hide it properly. Position it off screen and take it out of the tab order, so keyboard and screen reader users never land on it. Do not rely on a simple hidden attribute alone, since more capable bots recognize it.
- Check it on the server. The test happens where the form is received, not in the browser.
- Consider answering with a normal success message. The bot then believes the spam landed and moves on.
A honeypot does not slow anyone down, adds almost no page weight and, when hidden properly, raises no privacy or accessibility problems. It will not stop a person typing by hand, and it will not stop a bot built to ignore hidden fields. That is why it is a layer and not the whole answer.
Layer 2: a time check
Bots submit in a fraction of a second. People need a few seconds at least. Record when the form loaded and reject anything sent faster than a short minimum.
Keep the minimum short, around three seconds. Browser autofill can legitimately complete a short form in a couple of seconds, and you do not want to block those visitors. Also, a plain timestamp in a hidden field can be edited by a bot, so the server should record or sign the load time itself rather than trust a value sent from the page.
Layer 3: a rate limit
A rate limit caps how many submissions one visitor or address can send in a short period. Even a patient bot gets slowed to a crawl.
Cloudflare’s guide to protecting forms suggests measuring your normal request rate first, then setting a rule above that baseline. Its example is 5 requests per 10 seconds per IP address on the Free plan, with the action set to Block. On higher plans it suggests a Managed Challenge instead, so a legitimate visitor who trips the limit can still pass.
One caution: many people can share one IP address, such as everyone in an office or school. Set the limit high enough that a shared network does not lock out real users.
Layer 4: content checks and a review folder
This is the only layer that reads the message. Useful signals include:
- Many links in one message
- Web addresses in a name field
- HTML or forum-style link code in the text
- Known spam phrases
- The same message sent repeatedly
- Free or disposable email domains, if your business never hears from them
Do not delete what you flag. Send suspected spam to a separate folder you can scan quickly. A false positive in a review folder costs you a minute. A false positive that vanishes can cost you a customer.
This matters most for forms that feed other tools. If a form pushes leads into a spreadsheet, your email or a CRM, spam flows into all of them. Our guide on wiring email capture forms walks through connecting forms so that junk is caught before it reaches your list, and the one on testing website forms before adding scripts shows how to check the whole path with real test entries.
Layer 5: a CAPTCHA, only when the first four are not enough
A CAPTCHA is a challenge meant to separate people from bots. It is stronger than a honeypot against determined automation. It also adds friction for visitors, loads a third-party script and can create accessibility problems. That is the trade, and it explains the order of the layers.
Use one when you have measured persistent abuse that the invisible layers did not stop, or when the form guards something valuable, such as sign-ups that trigger emails or free trials.
reCAPTCHA v2 vs v3
- v2 (checkbox) shows the familiar “I’m not a robot” box and sometimes an image puzzle. The visitor sees the check.
- v3 (score) runs in the background and returns a score from 0.0 to 1.0 without interrupting anyone. Google suggests starting your threshold at 0.5 and adjusting after you review your traffic in the admin console.
With v3, decide in advance what a low score does. Options are blocking, asking for an email confirmation code, or sending the entry to your review folder. A review folder is the gentlest choice for a contact form.
Setting up Google reCAPTCHA on a form
The steps for v3, following Google’s documentation:
- Create a key for your site and choose the score-based (v3) type. Google now manages reCAPTCHA keys in a Google Cloud project, so new keys are created there. You get a public site key and a secret key. The site key goes in the page. The secret key stays on the server and is treated like a password.
- Load the reCAPTCHA script on the page with the form. Google recommends running it across your pages for more context, not only the form page.
- Run it when the visitor submits, not when the page loads. Tokens expire after two minutes, and generating one at page load is a common reason checks fail.
- Send the token with the form data to your backend.
- Verify on the server. Post the token and your secret key to Google’s verification endpoint, then check that the response says success and that the action name matches the one you expect.
- Act on the score using the threshold you chose.
Two details trip people up. A token can be verified only once. Reused or expired tokens come back as failures with the code timeout-or-duplicate, as Google’s verification documentation describes, so reset the widget after each attempt. And a “verified” flag in the browser proves nothing, because any client can set it. Only the server’s own check counts.
The same applies to every provider. A widget on the page with no server check stops nothing, because a bot can skip the widget and post directly. Cloudflare’s guide says the same: server-side validation is required since attackers can send data straight to the endpoint.
Alternatives to reCAPTCHA
If you want a different challenge, you have a few types to choose from:
- Managed challenges such as Cloudflare Turnstile. In Managed mode it chooses between a non-interactive check and a checkbox based on visitor risk. Setup has three steps: create a widget in the dashboard, add the client-side snippet, then validate the token on your server before processing the submission.
- Other invisible risk scoring, which works like v3.
- Proof of work, which makes the visitor’s browser do a small calculation. Bots at scale pay for it, people do not notice.
- Passkeys or other strong sign-in, for high-value flows like accounts.
Visible puzzles are a known accessibility barrier for many visitors. If you add any challenge, pick one that stays out of the way for real people.
Which layer for which problem
| What you see | What it suggests | Start with |
|---|---|---|
| Many entries per minute, random text | Bots | Honeypot, time check, rate limit |
| Same message repeated | Scripted resubmission | Duplicate detection, rate limit |
| Readable pitches with links | Human or hybrid spam | Content checks, review folder |
| Fake sign-ups that trigger emails | Bots targeting your mail | Add a CAPTCHA with server verification |
| Real leads lost | Over-aggressive filter | Loosen limits, review the spam folder |
What it looks like on WebsitePublisher
On WebsitePublisher, your AI assistant builds your websites and apps through the WebsitePublisher connector, which uses MCP, the open protocol AI tools use to work with outside services. You can do this from ChatGPT, Claude, Gemini, Mistral, Cursor and other supported assistants. The AI web platform is full-stack: hosting, forms, email, uploads and data sit in one built-in backend, and it snaps together 140+ integrations. Because your forms and the place that receives them live together, you can describe the behavior you want in plain language, such as how a form should be received and where submissions should go, and review the result.
Two habits keep this simple:
- Describe the whole path, not just the form. Say where entries go, which ones you want held for review, and what the visitor should see after sending.
- Test with real entries. Every change is live immediately, so submit a normal message, an empty one and a link-heavy one, and confirm each lands where you expect.
Agencies running several client sites can repeat the same layered setup on each. Our AI prompt templates are a good way to keep the wording consistent from site to site.
Our view: protect the visitor first
Most spam advice starts with the hardest wall. We start with the visitor. A person filling in your contact form wants to send a message and leave. Every puzzle you add is a reason for them not to.
That is why we think forms belong in the same place as the rest of the backend. When form handling, email and data live together in a full-stack platform, the checks that matter, the ones on the server, are part of the build and not a plugin bolted on afterward. Your AI assistant can set up the form, the destination and the review path in one conversation, and you see the result live immediately.
Our advice is the layered order in this article: invisible checks first, a challenge only on evidence, and a review folder so nothing real is lost. Build it, test it with real entries, and adjust.
Build the form and its protection with your own AI assistant
If you already work with ChatGPT, Claude, Gemini, Mistral or Cursor, you do not need a new tool to learn. Connect your assistant to WebsitePublisher and tell it what the site or app should do. It builds and publishes websites and apps on the built-in backend, and you adjust anything afterward in the visual browser editor. See the supported AI assistants and the AI website and app builder, or check the plans on our pricing page to start.

Switching assistants later does not cost you your project. Project memory and task history stay across sessions and assistants. Our piece on avoiding AI lock-in explains why that matters.
A short checklist before you launch
- Honeypot field with a meaningless name, off screen, out of the tab order, autocomplete off
- Server-side check of the honeypot and a short minimum fill time
- Rate limit set above your measured normal traffic
- Content checks for links, repeated messages and known spam phrases
- A review folder for flagged entries, not silent deletion
- If you add a CAPTCHA: secret key on the server, token verified on submit, a defined action for low scores
- A test with a normal entry, a bot-style entry and a link-heavy entry
FAQ
Is a honeypot enough to stop form spam?
For many small sites it stops most automated spam, and it costs visitors nothing. It cannot stop a person typing a message by hand or a bot built to skip hidden fields. Pair it with a time check, a rate limit and a content check.
Should I use reCAPTCHA v2 or v3?
v3 runs in the background and returns a score, so visitors see nothing. v2 shows a checkbox. Choose v3 if you want no interruption and are ready to decide what a low score does, such as sending the entry to a review folder. Either way, verify the token on the server.
Why am I still getting spam after adding a CAPTCHA?
Two common reasons. The token may not be verified on the server, so bots simply skip the widget. Or the spam is typed by a person, which a CAPTCHA does not read. Check the server verification first, then add content checks.
Does spam protection block real leads?
It can if a filter is too strict. A minimum fill time that is too long, a rate limit that catches a shared office network or an autofilled honeypot can all drop real messages. Keep thresholds modest and send flagged entries to a review folder instead of deleting them.
Sources
- Cloudflare: Protect your forms from spam and abuse
- Google for Developers: reCAPTCHA v3
- Google for Developers: Verifying the user’s response
Recommended
- Wire Email Capture Forms in 8 Steps for Marketers and Stop Spam
- Use Case Swipe File: Lead Capture Form Examples With Field Templates
- Typeform Website Integration: From Copy Paste to Reliable Webhooks
- Embed Mailchimp on Your Site: Menus, Where to Paste Code, Opt in Tips
Build your site the same way
Describe what you want. Your AI builds and publishes it — with the full stack behind it: data, auth, forms, payments, integrations and hosting.
See how it works →
Website