Falkenstein, Germany · Hetzner Online GmbH
FormHaven

A honeypot field for your contact form

A honeypot is one extra input that people never see and bots fill in. A message that arrives with it filled in is spam. It costs your visitor nothing and takes one line of HTML, as long as you hide it the right way.

14 days free, no card. Paste the address where the code says YOUR_FORM_ID.

contact.html
<!-- inside your <form>, next to the real fields -->
<input type="text" name="_gotcha"
  style="display:none"
  tabindex="-1"
  autocomplete="off">

Why each attribute is there

  1. 1

    type="text", not hidden

    An input with type="hidden" tells a bot the field is not for typing, so it can leave it alone. A text input looks like any other field, and a bot that fills in every field fills in this one.

  2. 2

    Hidden by style

    style="display:none" keeps it off the screen and out of screen readers, so no person sees it or hears it read out.

  3. 3

    Out of the Tab order

    If a stylesheet ever shows the field, tabindex="-1" still keeps the Tab key from landing on it.

  4. 4

    No autofill

    autocomplete="off" asks the browser not to fill it in from saved details, so a real visitor does not spring the trap by accident.

Use the name your form backend reads

FormHaven reads _gotcha (Formspree's name), _honeypot (Formspark's) and _honey (FormSubmit's), so a form moved from any of them keeps its trap as it is. The trap field itself is never stored with the answers or shown in your email.

contact.html
<input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<!-- also read: name="_honeypot" or name="_honey" -->

Test it from the command line

Send one message with the field filled in. You get the same answer as a real message, because a bot must not learn it was caught, and the message shows up in the form's spam list as caught by the hidden trap field. On a form set to keep nothing, it is dropped instead.

Terminal
curl -X POST https://formhaven.net/f/YOUR_FORM_ID -H "Accept: application/json" \
  -d "email=test@example.com" -d "message=hello" -d "_gotcha=x"

# {"ok":true,"message":"Thanks, your message was received.", ...}

What gets past it, and what to pair it with

A honeypot catches bots that fill in every field. A bot written for your form, one that drives a real browser, or a person pasting offers by hand leaves it empty. Pair it with the bot check, which has the browser solve a small puzzle before it sends, and with spam words for what the message says. Turn on the bot check in the form's settings and add this line once to the page.

contact.html
<script src="https://formhaven.net/bot-check.js" async></script>

Questions about this setup

Is a honeypot enough on its own?
It depends on who is posting. It costs nothing, so keep it on every form, and turn on the bot check the day spam starts getting past it.
Does it hurt accessibility?
Not when it is hidden with display:none: screen readers skip it and the keyboard cannot reach it. A field moved off screen with CSS instead stays in the reading order, so a screen reader user could end up filling it in.
Should I check the field in my own JavaScript?
No need. FormHaven checks it when the message arrives. A bot that posts to the address directly never loads your page, so it never runs a check that lives there.
What does a visitor see if they fill it in by accident?
The normal thank-you page. The message is filed as spam and not emailed, so look in the spam list if someone says you never answered.

More to read

Contact form templateA complete form with the honeypot in place Astro contact formA Contact.astro component for a static Astro site HTML form to emailOne line in the action, every message in your inbox Static site contact formOne form for Astro, Hugo, Eleventy, Jekyll or plain HTML Hugo contact formA partial and a shortcode for a static Hugo site Lovable contact formOne prompt for a site built with Lovable GDPR compliant contact formEU storage, a DPA and retention you set Kontaktformular nach DSGVOAuf Deutsch: gespeichert in Deutschland, mit AVV JavaScript contact formA fetch script that keeps the visitor on the page Vercel contact formFor plain HTML, Astro or Next.js hosted on Vercel FormSubmit not workingThe usual causes of a silent FormSubmit form Web3Forms not workingThe usual causes of a silent Web3Forms form Eleventy contact formAn include for a static Eleventy (11ty) site Formspree not workingThe usual causes of a silent Formspree form Export from FormspreeEvery Formspree submission, as a file Export from FormsparkEvery Formspark submission, as a file EmailJS not workingThe usual causes of a silent EmailJS form Form backend for AI agentsThe start request, every REST route and MCP tool Claude Code contact formOne prompt, then press Activate Cursor contact formThe prompt and the .cursor/mcp.json entry Contact form privacy policyThe paragraph to copy, in 8 languages GitHub Pages contact formFor user, organisation and project sites on github.io Cloudflare Pages contact formFor sites on pages.dev or your own domain Netlify contact formFor sites on netlify.app or your own domain React contact formOne component for Vite and other React apps Next.js contact formA client component that works with output: export Send form submissions to multiple emailsUp to 5 confirmed addresses per form, plus yours SvelteKit contact formOne Svelte 5 component, any adapter Nuxt contact formOne Vue component for Nuxt 4 and 3 Gatsby contact formOne component for a Gatsby 5 site HTML form webhookSigned JSON to your endpoint for every message Jekyll contact formAn include for Jekyll, on GitHub Pages or any host Angular contact formA standalone component that posts with HttpClient Contact form spamWhy forms get spam, and the layers that stop it Contact form without PHPFor hosts with no PHP, or mail() that lands in spam HTML form mailtoWhy action="mailto:" fails on webmail visitors, and the one-line fix Pricing€1 per form a month, €0.50 from the 11th

Get your form address in a minute

14 days free, no card. Then €1 per form a month, €0.50 from the 11th form.

Start your 14-day trial