Skip to content

Services · by Cloudflare

Cloudflare Turnstile

Add a check to a form that helps block automated submissions and often lets visitors continue without solving a puzzle.

If a contact form starts filling up with junk, Turnstile can check the visit before your site accepts the message. Its widget runs in the visitor’s browser and returns a short-lived result that your server verifies.

Try the check on a test form. Submit a normal message and make sure it reaches the inbox. Then check that the server rejects a submission missing the result. Both halves have to work for the form to benefit.

When to use it
When a sign-up, sign-in or contact form needs protecting from bots and you want no puzzles. Your site doesn’t need to be on Cloudflare.
When to skip it
When your product has no server code to check each pass and no service, such as Supabase, that checks it for you. If you want to protect Firebase services, follow Firebase’s App Check setup.
What it costs
Free, with unlimited checks and up to 20 widgets, as of November 2026.

Stop bots with Cloudflare Turnstile

Add a Turnstile check to a sign-up, sign-in or contact form. Your server confirms each pass before it accepts the form.

You’ll need

  • A website or app with a form you want to protect, like sign-up or contact.
  • Your AI tool, set up and working in your product’s folder.
  • Server code that handles the form, or Supabase sign-in.
  • Cloudflare account. Free to create.

Your part

  • Create the widget in the Cloudflare dashboard and copy its two keys somewhere private.
  • Add the real keys to your host’s settings.
  • Test the form on your live site, and check that a made-up pass is refused.

Copy the prompt for these steps

All 3 steps, in one prompt
I’m following “Stop bots with Cloudflare Turnstile” on BuildLadder.
What the guide says I’ll end up with: Your form shows a Turnstile check, and your server refuses any submission without a valid pass.
This comes from https://buildladder.com/tools/cloudflare-turnstile#security. If you can open web pages, read https://buildladder.com/tools/cloudflare-turnstile.md for the current version. BuildLadder guide, tool, concept, answer and setup pages all work this way: add .md to the address.

How to work with me:
- Go through the steps below in order, one at a time.
- Do what you can yourself in this folder: write code, run commands, check settings. If a service has an official command-line tool, like the Vercel CLI, you can offer to use it. Ask me before you install anything, sign in to anything or spend money.
- When a step needs me, like making an account or clicking in a dashboard, tell me exactly what to do in small steps. Then wait until I say it’s done.
- The actions, checks and fixes in each step were written for me, the reader. Where one says “your AI tool”, that means you, and “Say:” means something I would say to you.
- Never ask me to paste passwords or secret keys into this chat. I type those into the service’s own settings.
- After each step, tell me how to check it worked. Once Git is set up, save a version each time a step works. Then ask if I’m ready for the next one.
- Use plain words. I may never have coded before.

## Step 1 of 3: Create a Turnstile widget

This step is mine to do. Walk me through it, one action at a time:
- Go to dash.cloudflare.com and sign in, or create an account.
- Go to the Turnstile page in the dashboard.
- Select Add widget.
- In Widget name, type what it protects, like “Sign-up form”.
- Under Hostname management, add your site’s domain, like mysite.com. Leave out localhost. On your computer you’ll use test keys instead.
- Under Widget mode, choose Managed. It only asks a person to tick a box when it needs to.
- Select Create.
- Copy the site key and the secret key somewhere private, like a note only you can see.

It worked when: The Turnstile page lists a widget named after your form, and you have its site key and secret key.

Keep for later: You need both keys again in “Add the keys to your host and test”.

If something goes wrong:
- You can’t find the Turnstile page. Ask your AI tool: “Open Cloudflare’s current Turnstile docs and give me the link to the Turnstile page in the dashboard.”
- It says you’ve reached the widget limit. Reuse a widget you made before, or delete one you no longer use.

## Step 2 of 3: Add Turnstile and check it on the server

I want to protect a form in this product with Cloudflare Turnstile. Read PLAN.md if there is one. Check Cloudflare’s current Turnstile docs first. Don’t rely on memory.

Ask me which form to protect, like sign-up, sign-in or contact. Then:
1. If my sign-in uses Clerk, stop and tell me how to check Clerk’s own bot protection is turned on instead.
2. If my sign-in uses Supabase Auth, use Supabase’s built-in CAPTCHA support with Turnstile. Pass the captcha token to the sign-up and sign-in calls, and tell me where to paste the secret key in the Supabase dashboard.
3. Otherwise, add the Turnstile widget to that form in Managed mode, and send its pass to my server with the form.
4. On the server, check every pass with Cloudflare’s Siteverify API before doing anything else. Refuse the form if the check fails, and show a friendly message asking the person to try again.
5. Reset the widget after each send, because each pass works only once.
6. Read the site key and the secret key from environment variables. Make sure Git ignores .env, and tell me which name is public and which is secret.
7. On my computer, use Cloudflare’s test keys, which work on localhost. Put those test keys in .env for me. They are public, so that is safe. My real keys go only in my host’s settings.
8. Never put the secret key in code that runs in a browser or on a phone.

If my product has no server code, stop and explain my options before you change anything. Keep everything that already works.

It worked when: The widget shows on your form on your computer, and the form still sends when the check passes.

Before we move on, check with me:
- Did your AI tool show you the server code that calls Siteverify, or the Supabase setting it uses?

If something goes wrong:
- The widget shows error 110200, or says the domain isn’t allowed. The page’s address isn’t in the widget’s hostname list. On your computer, use the test site key 1x00000000000000000000AA. For your live site, add its domain under Hostname management.
- Your AI tool only added the widget, with no server check. Say: “Add a server check with Siteverify, and refuse the form when it fails.” Without it, a bot can skip the widget and send the form anyway.

## Step 3 of 3: Add the keys to your host and test

This step is mine to do. Walk me through it, one action at a time:
- Open your host’s environment variable settings. “Where do my API keys go?” in Answers names the page for Vercel, Netlify and Cloudflare.
- Add the site key and the secret key, using the names your AI tool gave you. Mark the secret key as secret if your host offers that.
- If you use Supabase sign-in, put the secret key in Supabase instead. In Supabase’s Authentication settings, find Bot and Abuse Protection and turn on Enable CAPTCHA protection.
- Still in Supabase, choose Turnstile as the provider, paste the secret key, and click Save.
- Put your site online again from your host, so it uses the new keys.
- Open your live site in a private browser window and send the form. It should go through.
- Ask your AI tool: “Send one request to my live form with a made-up Turnstile pass, and show me the reply.” It should be refused.

It worked when: The form on your live site goes through for a real visitor, and a made-up pass is refused.

If something goes wrong:
- The live form fails the check for everyone. Check that the secret key on your host belongs to this widget, then put the site online again. A test secret key only accepts test passes, so real visitors fail.
- The widget’s analytics show no validations. Your server isn’t calling Siteverify. Ask your AI tool to add the server check from “Add Turnstile and check it on the server”.
- The form fails when someone sends it a second time. Each pass works once and lasts 5 minutes. Ask your AI tool to reset the widget after each send, so a fresh pass is ready.

The steps

  • Steps marked AI tool are done by your AI tool when you paste the prompt. The rest are yours.
  • Save a version after every step that works.
  • If a screen looks different from a step, ask your AI tool where the setting moved.
  • Never paste a password or secret key into the chat.
  1. A form that turns bots away

    Create a Turnstile widget

    You

    A widget is one Turnstile check with two keys. The site key is public and goes in your page. The secret key stays on your server and in your host’s settings.

    1. Go to dash.cloudflare.com and sign in, or create an account.
    2. Go to the Turnstile page in the dashboard.
    3. Select Add widget.
    4. In Widget name, type what it protects, like “Sign-up form”.
    5. Under Hostname management, add your site’s domain, like mysite.com. Leave out localhost. On your computer you’ll use test keys instead.
    6. Under Widget mode, choose Managed. It only asks a person to tick a box when it needs to.
    7. Select Create.
    8. Copy the site key and the secret key somewhere private, like a note only you can see.

    It worked when: The Turnstile page lists a widget named after your form, and you have its site key and secret key.

    Keep: You need both keys again in “Add the keys to your host and test”.

    You can’t find the Turnstile page.

    Ask your AI tool: “Open Cloudflare’s current Turnstile docs and give me the link to the Turnstile page in the dashboard.”

    It says you’ve reached the widget limit.

    Reuse a widget you made before, or delete one you no longer use.

  2. Add Turnstile and check it on the server

    AI tool

    The widget goes on your form, and new server code sends each pass to Cloudflare. A form that skips this server check isn’t protected at all.

    It worked when: The widget shows on your form on your computer, and the form still sends when the check passes.

    Check this step
    • Did your AI tool show you the server code that calls Siteverify, or the Supabase setting it uses?
    The widget shows error 110200, or says the domain isn’t allowed.

    The page’s address isn’t in the widget’s hostname list. On your computer, use the test site key 1x00000000000000000000AA. For your live site, add its domain under Hostname management.

    Your AI tool only added the widget, with no server check.

    Say: “Add a server check with Siteverify, and refuse the form when it fails.” Without it, a bot can skip the widget and send the form anyway.

  3. Add the keys to your host and test

    You

    Your live site needs the real keys, which go in your host’s settings. A request with a made-up pass then shows whether your server really checks.

    1. Open your host’s environment variable settings. “Where do my API keys go?” in Answers names the page for Vercel, Netlify and Cloudflare.
    2. Add the site key and the secret key, using the names your AI tool gave you. Mark the secret key as secret if your host offers that.
    3. If you use Supabase sign-in, put the secret key in Supabase instead. In Supabase’s Authentication settings, find Bot and Abuse Protection and turn on Enable CAPTCHA protection.
    4. Still in Supabase, choose Turnstile as the provider, paste the secret key, and click Save.
    5. Put your site online again from your host, so it uses the new keys.
    6. Open your live site in a private browser window and send the form. It should go through.
    7. Ask your AI tool: “Send one request to my live form with a made-up Turnstile pass, and show me the reply.” It should be refused.

    It worked when: The form on your live site goes through for a real visitor, and a made-up pass is refused.

    The live form fails the check for everyone.

    Check that the secret key on your host belongs to this widget, then put the site online again. A test secret key only accepts test passes, so real visitors fail.

    The widget’s analytics show no validations.

    Your server isn’t calling Siteverify. Ask your AI tool to add the server check from “Add Turnstile and check it on the server”.

    The form fails when someone sends it a second time.

    Each pass works once and lasts 5 minutes. Ask your AI tool to reset the widget after each send, so a fresh pass is ready.

Compare Cloudflare Turnstile with the other options

Stuck? Try these, in order
  1. Stop asking it to “fix it”. Say exactly what’s wrong.

    Paste this into the same chat. It asks your AI tool to find the problem with you.

    Troubleshooting prompt
    I’m following “Cloudflare Turnstile” on BuildLadder and something isn’t working.
    This comes from https://buildladder.com/tools/cloudflare-turnstile. If you can open web pages, read https://buildladder.com/tools/cloudflare-turnstile.md for the current version. BuildLadder guide, tool, concept, answer and setup pages all work this way: add .md to the address.
    
    Ask me which step I’m on, what I tried and what happened, one question at a time. Look at the files in this folder if you can. Then explain the problem in plain words and suggest the smallest fix. Don’t change anything that already works.

  2. Check the service isn’t down.

    If you use one of these, open its status page before changing any code: Supabase, Vercel, Netlify, Cloudflare, Stripe, Clerk, Firebase, Resend, GitHub, Expo, Claude, OpenAI.

  3. Go back to your last saved version.
    Troubleshooting prompt
    Take my product back to the last saved version that worked. First show me which version that is and what will change. Don’t delete anything else.

  4. Make the change smaller.
    Troubleshooting prompt
    Let’s make a smaller change. Undo what you just tried. Then do only the first part of it, and tell me how to check that part works before we go on.

  5. Ask a person.

    Copy this, fill in each line, and post it in a community like r/vibecoding. Take out any keys or passwords first.

    Problem report
    What I'm building: (one sentence)
    What I asked my AI tool to do: (the last request)
    What I expected: (what should happen)
    What happened instead: (what you see)
    The exact error, if any: (copy it here)
    What I've tried: (each attempt, in order)
    My tools: (AI tool, website or app, hosting)

Look things up

Questions people ask

Words used on this page

Captcha
A captcha is a quick check that a person, not a bot, is filling in a form. It runs in the browser, then your server asks the captcha service whether the visitor passed.
API key
An API key is a long code that tells a service your app is allowed to use it. Many keys are secret, so treat them like passwords and keep them out of shared code.
Domain
A domain is the name people type to reach your website, like buildladder.com. You rent it from a domain seller, usually for a yearly fee, and point it at your hosting.
Environment variable
An environment variable is a named setting stored outside your code, such as an API key or a database address. Your app reads it when it runs, so secrets stay out of your shared files.
Backend
The backend is the behind-the-scenes part of an app that visitors never see. It runs on a server, where it saves data and checks who is signed in.
Localhost
Localhost is the name your computer uses for itself. When your site runs at an address like http://localhost:3000, it's a private preview that only you can see.
Deploy
To deploy means to put your website or app online so other people can use it. You send your product to a hosting service, which gives it a public web address. This site says “put it online”.
Production
Production is the live version of your website or app that real people use. Changes there affect everyone, so you test them in a preview first.

Official pages

Updated · Cloudflare