TapCub is live — analytics, insights and live chat, free on one platform
AI Search

Honeypot field: an accessible spam trap with a time check

Build a honeypot field that people never meet: accessible markup, a signed time check, tested server-side validation, and a sample month showing what it catches and who it wrongly stops.

Lucas Hayes Published Dec 3, 2026 12 min read AI Search
Sample data: 1,838 of the 2,400 were spam on manual review; 90 spam messages were still accepted and 4 real senders were rejected.Sample data

A honeypot field is a form input that people never see or reach and that should arrive empty. Automated spam often fills it, so your server can filter those submissions without asking visitors to solve anything. Make it accessible, add a signed time check, validate on the server and measure false positives.

What you will learn

  • Hide the trap with off-screen CSS plus inert, tabindex -1 and a neutral name, so people, screen readers and autofill leave it alone
  • Sign the form's timestamp on the server; send very fast submissions to review rather than rejecting them
  • In the sample month, rejection stopped 89.0% of spam and wrongly rejected 4 of 562 real senders: measure both

What is a honeypot field?

A honeypot field is an extra form input that people never see or reach, which the server expects to arrive empty. Simple spam software fills every input it finds, so a value in that field marks the submission as automated. Visitors do nothing, solve nothing and usually never know it exists.

The W3C note Inaccessibility of CAPTCHA lists honeypots among the non-interactive alternatives to challenges: easy to implement, even in hand-written markup, and worth considering. The idea is simple. The details decide whether it only catches bots or also catches your customers, so this guide builds one in four parts: markup that people cannot meet by accident, a signed time check, server-side validation with tested outcomes, and measurement of both catches and mistakes.

It is a defensive filter for your own contact, sign-up and comment forms. It will not stop someone who writes a script for your form in particular.

Add the HTML so people never meet it

<form method="post" action="/contact">
  <div class="hp" inert aria-hidden="true">
    <label for="referral_note">Leave this field empty</label>
    <input type="text" id="referral_note" name="referral_note"
           tabindex="-1" autocomplete="off">
  </div>

  <input type="hidden" name="form_token" value="{{ token }}">

  <label for="email">Email</label>
  <input type="email" id="email" name="email" autocomplete="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" required></textarea>

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

<style>
  .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
</style>

Each attribute closes a specific hole:

Attribute or choiceWho it protectsWhat goes wrong without it
Off-screen CSSSighted usersThey see a puzzling extra box
inert on the wrapperKeyboard and screen reader usersThe field can be focused or announced
aria-hidden="true" and tabindex="-1"Users of older browsersSame, where inert is not supported
Visible label "Leave this field empty"Anyone who gets the page without CSSThey cannot tell what the box is for
A neutral name such as referral_notePeople using autofillA name like url, email or phone invites the browser to fill it
autocomplete="off"People using autofillMore risk of stored values; it is a request, not a guarantee

The HTML Standard says inert nodes generally cannot be focused and are not exposed to assistive technologies, and that authors should only mark content inert when it is also visually obscured, which is the case here. Inert is not the same as disabled: the standard's rules for building form data skip disabled fields, not inert ones, so the empty honeypot is still sent.

Do not put aria-hidden on something that can take focus. W3C's Using ARIA warns that doing so leaves some users focused on "nothing". Here inert removes focus from the wrapper's contents first.

There is a trade-off in the name. A tempting name such as website attracts more naive bots and also more autofill. Start neutral, measure, and change only if the catch rate is poor.

LayerCatchesRisk to real people
Honeypot fieldSoftware that fills every inputAutofill filling the trap
Missing or altered field and tokenPosts that never loaded your formCustom front ends that omit the field
Minimum timeInstant submissionsFast typists and password managers
Maximum ageOld reused tokensTabs left open a long time
Rate limitRepeated submissionsMany people behind one address

Reject only on strong evidence; hold or ask to resend when real people could be affected.

Add a signed time check

A person needs a few seconds to read a form and type. A script can post it in milliseconds. To use that, the server has to know when it served the form, and it cannot trust a plain timestamp in a hidden field, since the sender can edit it.

So sign it. When rendering the page, create a token made of the current time plus an HMAC of that time with a secret only your server knows. On submit, recompute the HMAC; if it matches, the time is the one you issued.

Two limits need care:

  • Minimum time. 3 seconds is a sample value. Password managers and returning visitors can be quick, so send fast submissions to review instead of rejecting them.
  • Maximum age. An expiry stops one token being reused indefinitely, but it is also a time limit on the person. WCAG 2.2 success criterion 2.2.1 (level A) lists a limit longer than 20 hours as one of its exceptions, so a 24-hour expiry stays clear of it. If a token does expire, show the form again with everything the person typed.

If your pages are cached, every visitor gets the same old token. Fetch the token with a small uncached request, or exclude the form page from the cache.

Validate the honeypot on the server

Front-end checks are useless here: a bot can post straight to your endpoint without running any of your JavaScript. All decisions happen on the server. A sample in Node.js, using only the standard library:

const crypto = require('node:crypto');
const SECRET = process.env.FORM_SECRET;
const MIN_MS = 3000;
const MAX_MS = 24 * 60 * 60 * 1000;

const sign = (v) => crypto.createHmac('sha256', SECRET).update(v).digest('base64url');

function issueToken(now = Date.now()) {
  return `${now}.${sign(String(now))}`;
}

function checkSubmission(body, now = Date.now()) {
  if (body.referral_note !== '') return { verdict: 'reject', reason: 'honeypot' };
  const [ts = '', mac = ''] = String(body.form_token ?? '').split('.');
  const good = Buffer.from(sign(ts));
  const got = Buffer.from(mac);
  if (!ts || got.length !== good.length || !crypto.timingSafeEqual(got, good)) {
    return { verdict: 'reject', reason: 'bad_token' };
  }
  const age = now - Number(ts);
  if (age > MAX_MS) return { verdict: 'resubmit', reason: 'expired' };
  if (age < MIN_MS) return { verdict: 'review', reason: 'too_fast' };
  return { verdict: 'accept', reason: 'ok' };
}

The honeypot test is !== '' on purpose: a browser submitting your form sends the field with an empty value, so both a filled field and a missing field are wrong. If your front end builds the request itself with JavaScript, include the empty field in it.

Results of running that function against test inputs:

Test inputVerdictReason
Empty trap, valid token, 40 s after issueacceptok
Trap filledrejecthoneypot
Trap field missingrejecthoneypot
Empty trap, 1 s after issuereviewtoo_fast
No tokenrejectbad_token
Timestamp edited, old signaturerejectbad_token
Tab left open for 25 hoursresubmitexpired

Keep your normal validation as well: required fields, lengths, allowed characters, CSRF protection. A honeypot replaces none of them.

What to do with a caught submission

VerdictWhat the sender seesWhat you store
acceptThe normal confirmationThe message
reviewThe normal confirmationThe message in a held queue, with the reason
resubmitThe form again, filled in, asking to send once moreA count
rejectA neutral "could not send" with another way to reach youReason, time and a short sample, for a limited period

Do not tell the sender which check failed; that is free tuning advice for whoever is probing. Do not silently discard either, at least not at first: a real person caught by autofill should have another route, and you need samples to find your false positives. Decide how long to keep rejected content, since it may contain personal data.

How to test a honeypot field

  1. Keyboard only. Tab through the form. Focus must never land on the hidden field.
  2. Screen reader. Read the whole form. "Leave this field empty" should not be announced.
  3. Autofill. In each browser and password manager your users have, let it fill the form, then confirm the trap is still empty.
  4. No CSS. Load the page with styles disabled. The label should explain the box.
  5. Narrow screens and right-to-left layouts. The off-screen technique must not create a horizontal scroll bar.
  6. Cached page. Load it the way a visitor would after caching and check the token is fresh.
  7. Server cases. Submit the test inputs in the table to a staging copy of your own form and compare verdicts.
  8. After every form change. Redesigns and form builders love to restyle hidden inputs.

Measure what it catches and what it costs

Log one reason per submission and, for the first weeks, label a sample by hand. Sample data for one month of a contact form, fully reviewed:

Verdict and reasonSubmissionsSpamReal people
reject: honeypot1,5001,4973
reject: bad token1401391
review: too fast12010812
resubmit: expired1046
accept63090540
Total2,4001,838562

What it says:

  • Automatic rejection stopped (1,497 + 139) ÷ 1,838 = 89.0% of spam.
  • Counting held messages, 94.9% never went straight to the inbox as accepted mail.
  • 90 spam messages still got through, 4.9% of spam and 14.3% of what was accepted.
  • 4 real people were rejected, 0.7% of real senders. Three of them tripped the honeypot: check autofill first.
  • Another 18 real people were delayed (12 held, 6 asked to resend). A too-fast threshold that is one tenth real people argues for review, not rejection.

If spam keeps arriving with empty traps and plausible timing, the sender has adapted. That is the signal to add other layers.

app.tapcub.com

2,400 submissions in one month by verdict

submissions
Rejected: honeypot filled1,500
Accepted630
Rejected: bad token140
Held for review: too fast120
Asked to resend: expired10
Sample data
Sample data: 1,838 of the 2,400 were spam on manual review; 90 spam messages were still accepted and 4 real senders were rejected.

Limits of a honeypot field

  • Targeted scripts read your markup and leave the field alone.
  • Automated real browsers may respect CSS and inert and never fill it.
  • People paid or inclined to spam pass every automation check.
  • Replayed tokens are valid until expiry. Limit submissions per token and per source.
  • Account security is out of scope. Login attacks need rate limiting, multi-factor authentication and monitoring; see brute force attack.

For sign-up forms, add email confirmation and the other checks in fake account prevention. If your problem is broader than forms, compare categories of tooling and their false positives in bot prevention solutions.

Reporting on honeypot results in TapCub

TapCub does not add the honeypot or block submissions; your server does. It can put the verdicts next to your traffic, so the sample table above becomes a chart you can watch.

  1. Send an event per verdict from your server, for example contact_checked with verdict and reason properties. Do not include the message, email address or trap contents.
  2. Count browser submits too. With Form submits turned on under Web analytics › Configuration › SDK code and data-forms="true" on the script tag, TapCub records __form with the form's id, name and action, not field values; see track form submissions. Scripts that post directly to your endpoint never run the page, so a server count far above __form is itself a clue.
  3. Break down by reason in All-platform analytics › Behavior › Event analysis. A sudden rise in review or reject right after a redesign suggests autofill or caching broke.
  4. Alert on change. Save the rejected share as a formula metric under All-platform analytics › Behavior › Metrics & SQL and monitor it in All-platform analytics › Operations › Monitors (Pro plan or above).
  5. Mark form releases in Configuration › Annotations.

How to find where real people give up on a form, without recording what they type, is covered in form analytics.

FAQ

Do honeypot fields still work?

They still catch software that fills every input or posts without loading the page, which is a large part of ordinary form spam on many sites. They do not catch scripts written for your form. Measure your own catch rate and false positives instead of assuming either result.

Should the honeypot use type="hidden" or CSS?

Use a normal text input hidden with CSS. A hidden input is an obvious non-user field that simple bots may leave alone. Add inert, aria-hidden and tabindex="-1" so keyboard and screen reader users do not encounter it.

Can browser autofill trigger a honeypot?

Yes, and it is the main source of false positives to watch. Avoid names and labels that look like standard personal fields, set autocomplete="off" while knowing browsers may not always follow it, and test with the password managers your users use.

Is a honeypot enough without a CAPTCHA?

For low-value forms it often is, together with a time check, content filtering and rate limits. For logins, payments or anything worth targeting, use stronger controls. Keep a challenge available for requests that look risky.

Does a honeypot collect personal data?

The mechanism itself needs none. Your logs of rejected submissions may contain names, addresses and messages, so limit what you keep and for how long, and cover it in your privacy notice as required. This is general information, not legal advice.

Sources

Filed underAI Search

Was this article helpful?

We use your answers to fix and expand this page.

Lucas Hayes

Data Engineer

Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.

Watch spam verdicts next to your form traffic

Send each verdict as a server event, compare it with form submits and get alerted when the rejected share jumps.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics