Spam protection snippets for contact forms
Most form spam is dumb bots. Two cheap, privacy-friendly traps stop a lot of it without a CAPTCHA. Pick one or combine them, then copy the snippet.
Which one should you use?
- Honeypot field. Zero friction for people. Catches the majority of generic bots. Minuteform drops any submission where
_gotcha(or_honey) is non-empty and still returns success, so bots get no signal. - Time trap. People take a few seconds to fill a form; naive bots submit instantly. This runs in the visitor's browser, so a bot that skips your page and POSTs straight to the endpoint won't hit it. Treat it as a speed bump, not a lock.
None of these stops a determined, targeted attacker, and they aren't accessibility barriers: the honeypot is hidden from screen readers and keyboard users. Server-side rate limits matter too; Minuteform applies 10 submissions a minute per form and visitor. Check yours with the endpoint tester.
More free tools: Form migration tool · Contact form generator · Form endpoint tester · Spam-protection snippets · Lead response calculator
Powered by Minuteform, free plan: 1 form, 100 submissions a month, no card. Get a free endpoint · API docs · Source (MIT)