🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials October 20, 2026

Self-hosted CAPTCHA for Gravity Forms: Stop Spam Without a Third-party Service

GravityExtra
Self-hosted CAPTCHA for Gravity Forms: Stop Spam Without a Third-party Service

Every public form on a WordPress site gets found by bots sooner or later. The contact form fills up with offers for cheap backlinks, the quote form with invented companies, the newsletter form with addresses that bounce. Each fake entry sends a notification e-mail, eats into your attention and, if the form feeds a CRM or a mailing list, pollutes the data you rely on.

The usual answer is a CAPTCHA service. It works, but it comes with a price that is easy to overlook: a script from another company on every page with a form, cookies, visitor data sent to that company, a line in your privacy policy and often an entry in your cookie banner. For a small business, a school or a club, that is a lot of paperwork just to protect a contact form.

This guide shows how to protect Gravity Forms with a self-hosted CAPTCHA instead: a math question, a distorted text image or “pick the icon”, created and checked entirely on your own server with the GravityExtra Image and Math Captcha add-on.

Why a Self-hosted CAPTCHA?

  • Privacy by design. Nothing is loaded from or sent to another company. There is no third-party processor to list and no tracking cookie to explain.
  • No account and no keys. Install, activate, add the field. Nothing expires, nothing needs to be renewed with an outside service.
  • Nothing to break. Your forms do not depend on another company’s uptime, rate limits or pricing changes.
  • Fast. No extra script download; the question is part of the form.
  • Your choice of challenge. Pick the question style that suits your audience, form by form.

The honest trade-off: a self-hosted question on its own is easier for a dedicated attacker to solve than a large commercial service. That is why the add-on combines the visible question with four invisible layers, explained below. Together they stop the automated, high-volume spam that makes up nearly all form spam.

The Three Question Types

A Kiln firing request form on the site with name, e-mail and message fields and the Spam check field: Pick the house, with six icon buttons (cloud, house, star, cup, fish and key style drawings) and the buttons New question and Use a math question instead, above the Send button
Pick the icon: six bundled icons, each with an accessible name, usable with the keyboard.

1. A simple math question

“What is 4 + 7?” is answered by any person in two seconds. You choose the operators (plus, minus, times), the difficulty and whether numbers are shown as digits or written out as words, which simple bots find harder to read. Math is also the most accessible choice: it is plain text that every screen reader reads aloud, and the answer box is labelled by the question.

2. A distorted text image

A Book a wheel class form with the Spam check field showing a distorted text image of four characters drawn on the server, the label Type the characters in the image, an answer box and the buttons New image and Use a math question instead
Distorted text image drawn on your server with PHP GD and a bundled open-licence font.

The classic: a few characters drawn with rotation, a wave and noise. The add-on draws the image on your server with PHP GD and a bundled open-licence font, and embeds it in the form, so the browser makes no extra request. Only characters that cannot be mixed up are used, so visitors never have to guess between a zero and the letter O, and upper or lower case are both accepted.

3. Pick the icon

“Pick the house” with a row of small drawings is the friendliest option on phones. Each icon is a proper radio button with an accessible name, so it works with touch, mouse and keyboard alike. The values sent with the form are random for every question, so a bot cannot simply look for the word “house”.

With the image and the icons, visitors can always click Use a math question instead. It is the accessible way through for anyone who cannot see the picture.

The Invisible Layers That Do the Heavy Lifting

Most spam is sent by scripts that never load your page in a real browser. They post the same request again and again, as fast as possible. The add-on is built to make exactly that fail:

  1. Signed, single-use questions. Each question comes with a token signed by your site. The token belongs to one form, expires after a lifetime you choose and is spent at the first answer, right or wrong. Replaying a request that worked once does not work twice.
  2. Only a hash is stored. The server keeps a hash of the right answer, never the answer itself, and deletes it when the question is used.
  3. A minimum answer time. People need a few seconds to read and answer. Answers that arrive faster are refused.
  4. A honeypot. A hidden field that people never see or reach with the keyboard. Form-filling bots fill it in and are refused.
  5. A limit per IP address. After a number of wrong answers in ten minutes, the address is refused until the ten minutes are over. Addresses are stored only as a hash.

How to Set It Up in Five Minutes

  1. Install and activate the add-on, then activate your licence key in Forms → Settings → Image & Math Captcha.
  2. Check the line at the top of the settings: it confirms that your server can draw the text image.
  3. Choose the default question type, the math operators and the difficulty. The preview at the bottom of the page shows what visitors will see.
  4. Open a form, click Image & Math Captcha in Advanced Fields and drop the field just above the submit button.
  5. Optionally choose a different question type for this form, then save. Done.

The defaults are a good start for most sites: math questions with addition and subtraction, a 20 minute lifetime, a 3 second minimum time, the honeypot on and 10 wrong answers per IP address in ten minutes.

It Works With the Forms You Already Have

Spam protection that breaks your forms is worse than spam. The add-on was tested with the situations that trip up many CAPTCHA tools:

  • AJAX forms are checked without a reload; a wrong answer brings a new question in place.
  • Multi-page forms can hold the field on any page. Visitors answer once; a signed, single-use pass carries the result to the final submit.
  • Errors in other fields do not cost a second question: the form returns with “Spam check passed”.
  • Save and Continue never stores a question, an answer or a pass in the saved draft.
  • Several forms on one page each get their own question.
  • Page caching: when a page cache is active, the question is loaded from your own site right after the page loads, so two visitors of the same cached page never share a question.

See the Result on Every Entry

The Gravity Forms entry list of the Contact the studio form with the columns Spam check (passed), Spam check type (math, icons or text) and Spam check seconds next to the name and e-mail of each entry
Every entry keeps the result, the challenge type and how many seconds the visitor needed.

Each saved entry records that the spam check passed, which question type was used and how many seconds the visitor needed. Add these as columns in the entry list, filter by them or export them. If you see many entries answered in exactly the minimum time, raise it; if real visitors switch to math often, make math the default.

Choosing the Right Question Type

Your audience Good choice Why
General public, many phone users Pick the icon One tap, no typing.
Accessibility matters most Math question Plain text, read by every screen reader.
Targeted by smarter bots Text image, 6 characters Harder to read automatically.
International visitors Math with digits or icons No language needed to answer.

You can mix: a math question on the newsletter form, icons on the contact form and a text image on a public sign-up form, all with the same add-on.

Tuning Tips for Busy Forms

Start with the defaults and look at your entries after a week. The seconds column tells you a lot: real visitors usually need between three and twenty seconds, depending on the question type and the device. If spam still gets through and the answers arrive in exactly the minimum time, raise the minimum time by a second or two, or switch that form to words or a text image.

If real visitors complain that their answer expired, the form is probably long and the lifetime too short, or a page cache is serving an old question. Raise the lifetime to 30 or 45 minutes, or set page caching to load the question after the page loads. Both changes are safe and take effect at once.

Shared networks such as schools, offices and mobile carriers can put many people behind one IP address. If several honest visitors share an address, raise the number of wrong answers allowed per IP address rather than turning the limit off. Ten minutes later every address starts with a clean slate again.

Frequently Asked Questions

Does it need an account or an API key?

No. There is nothing to sign up for. Everything runs inside your WordPress site.

Does it slow down my pages?

No. There is one small script and stylesheet on pages that have a protected form, and the question is part of the form itself.

Is it GDPR friendly?

Yes. No data leaves your server, no cookies are set and IP addresses are stored only as short-lived hashes for the rate limit. As always, describe your forms in your privacy policy.

What if my host does not have PHP GD?

Then the text image is not available and fields set to it ask a math question instead. Icons and math work on every server.

Which versions are supported?

Gravity Forms 2.9 or newer with WordPress 6.5 and PHP 7.4 or newer. The add-on is tested with Gravity Forms 2.9 and 3.1.

Ready to keep spam out without sending your visitors anywhere? Add the field once and forget about it.

Stop form spam without a third-party service

Math, text image or icons, checked on your own server.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr