Contact form · Gatsby
Contact form for Gatsby websites
Gatsby is React under the hood, so any React form works — but the build is static. Use the splitforms endpoint to skip Netlify Forms (which only work on Netlify-hosted sites), Lambdas, Gatsby Functions, and AWS API Gateway entirely. One React component, 500 free submissions a month, dashboard included.
- 500 free / month
- One endpoint
- No backend code

Key benefits
No backend code
No server, API route, or SDK. Your Gatsby form posts straight to one endpoint.
Straight to your inbox
Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it reaches you.
Design without limits
It's your own Gatsby markup and styles. Splitforms is only the backend, so nothing constrains how the form looks.
Copy-paste ready
Your Gatsby contact form, ready to paste.
Replace YOUR_ACCESS_KEY with the key from your dashboard — that's the whole integration. No SDK to install, no build step, just the jsx you already write.
How to add it
How to add a contact form to a Gatsby website.
To add a contact form to a Gatsby website you need three things: a free splitforms access key, the jsx snippet above, and your key pasted into it. No backend, server, or SDK — the form posts to one URL and every submission lands in your inbox and dashboard.
Get your free splitforms access key
Sign up at splitforms.com, verify your email, and copy your access key from the dashboard. No credit card required.
Drop the Gatsby snippet into your project
Copy the Gatsby code example into your project and replace YOUR_ACCESS_KEY with the key from step 1.
Receive submissions in your dashboard
Submissions arrive in the splitforms dashboard within seconds. Free includes owner email notification attempts; Pro adds Slack, Discord, Sheets, or any signed webhook URL.
Where submissions go
Where do your Gatsby form submissions go?
Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it ever reaches you. Search, export to CSV, or forward it to a webhook or Slack on Pro.
- 500 submissions a month, free to start
- Honeypot + automatic spam scoring on every plan
- Signed webhooks to Slack, Discord, your server

No backend needed
Do you need a backend for a Gatsby form? No.
Your Gatsby form posts standard FormData to one URL. Splitforms validates the access key, runs its spam checks, and forwards it to your email — so there's no server, API route, or database for you to build or maintain.
- Plain React component — drop into any Gatsby page
- No Netlify Forms, no Lambda, no Gatsby Functions required
- Works with Gatsby Cloud, Netlify, Vercel, Cloudflare Pages, self-hosted

Best practices
What a production-ready Gatsby form needs.
The difference between a form that works in the demo and one that survives launch traffic — the production-tested defaults, in priority order.
- Use GATSBY_SPLITFORMS_KEY in your .env.production and .env.development files. Gatsby reads them at build time and inlines the value into the static JS bundle — that's expected, lock the key to your domain.
- Don't wrap the form in <Link> or any component that intercepts navigation. Use a normal <form> element with onSubmit.
- If you have multiple forms (contact, demo, newsletter), include a form-name hidden field per form so the splitforms dashboard groups them.

How do I add a contact form to Gatsby?
Drop the React component above into src/components/ContactForm.jsx, set GATSBY_SPLITFORMS_KEY in your .env, and import the component on any page. No plugin, no gatsby-config edits required.
Does splitforms work with Gatsby v4 and v5?
Yes — both. The component is a standard React function component, no Gatsby-specific APIs. For v5 partial hydration, add 'use client' at the top of the file so the onSubmit handler binds on the client.
How do I handle form errors in Gatsby?
Use a status state with four values: idle, loading, ok, err. Render error messages from data.message inside an {status === 'err' && …} block. The fetch returns { success, message? }.
Can I use splitforms with Gatsby Functions or Netlify Functions instead?
You can, but you don't need to. The whole point of splitforms is replacing the function. If you do want a server-side proxy (to hide the key entirely), POST from a Gatsby Function and forward to splitforms — same backend.
How do I customize the success / redirect behavior?
Two options. (1) Stay on-page with a React-rendered success message (default in our snippet), or call Gatsby's navigate() after success. (2) For a native form post, add a hidden redirect field pointing at /thanks — free on every plan — or configure a default absolute URL in Dashboard → Form settings → Redirect.
Will this work with Gatsby Cloud / Netlify / Vercel / Cloudflare Pages?
Yes — every host. The form posts to splitforms.com from the static page, regardless of where the static files are served from. Splitforms's allowed-domains list just needs to include your live URL.
Show 8 more questions
GATSBY_ prefix required for env vars exposed at build time
Gatsby's webpack config only exposes process.env.* variables prefixed with GATSBY_. If you write process.env.SPLITFORMS_KEY, you'll get undefined in the browser bundle. Rename to GATSBY_SPLITFORMS_KEY — and accept that it's bundled into the static JS (lock the key to your domain in the splitforms dashboard).
Gatsby's <Link> can't wrap a form's submit handler
Gatsby's <Link> component prevents default navigation. Do not wrap the form in a Link. For fetch-based forms, call Gatsby's navigate('/thanks') after a successful response. For native form posts, configure the absolute thank-you URL in the splitforms dashboard.
SSR + client hydration mismatch on form initial state
If you use useState('idle') in your form and render any state-dependent UI on first paint, Gatsby's static HTML and React's client render can diverge — you'll see a hydration warning. Render the form unconditionally; only render status messages inside the handler-triggered branches.
Gatsby v5 partial hydration changed how forms hydrate
Gatsby 5 introduced partial hydration via React Server Components. If your form is in a Server Component, the onSubmit handler won't bind. Add 'use client' at the top of the file (or use a separate ContactForm.client.jsx).
@reach/router (legacy) intercepts form submits with onSubmit handlers
Older Gatsby setups used @reach/router, which has a known issue where it sometimes intercepts form submissions. If you see your form not POSTing, ensure you've migrated to Gatsby v4+ (uses its own router) or wrap the form in a normal <div> not <Router>.
gatsby-plugin-offline caches the contact page and serves a stale form
If your site uses gatsby-plugin-offline (or the older gatsby-plugin-manifest with service worker registration), the contact page HTML is cached aggressively. After you rotate your GATSBY_SPLITFORMS_KEY and redeploy, returning visitors keep submitting against the old key from the cached bundle until the service worker fetches a fresh shell — sometimes days. Fix: bump the SW cache version in gatsby-config.js on key rotation, or skip the offline plugin on the contact route via runtimeCaching rules. Alternatively, switch to gatsby-plugin-pwa which handles versioned cache invalidation per-page.
How does Gatsby handle forms without splitforms?
Gatsby builds a static React app, so 'native' means choosing between (a) Netlify Forms for Gatsby sites hosted on Netlify, with gatsby-plugin-netlify required, (b) Gatsby Functions (deprecated in Gatsby 5 — they were removed when Gatsby Cloud shut down), or (c) a third-party form backend. Gatsby v4 had Functions running as Lambda-equivalent serverless routes; v5 removed them entirely. Result: every Gatsby contact form today uses an external service. Splitforms is the portable drop-in option — the same POST shape as Netlify Forms or Formspree, with built-in spam filtering.
Any deployment notes for shipping Gatsby to production?
Gatsby builds static HTML + JS that deploys to any host: Netlify, Vercel, Cloudflare Pages, AWS Amplify, S3 + CloudFront, Gatsby Cloud (sunset 2024 — migrate). The form posts cross-origin to splitforms regardless of host. Env vars exposed to the browser bundle must be prefixed GATSBY_ — anything else is undefined client-side. The key gets bundled into the JS at build time; lock it to your domain in the splitforms dashboard. For headless Gatsby + WordPress / Contentful setups, the form lives in the React tree, not the CMS — no special CMS wiring required.
Simple pricing
Start free. Upgrade when you need more.
Ship your Gatsby contact form in 60 seconds.
Free to start on 500 submissions a month. Need Slack alerts, signed webhooks, or file uploads? Pro unlocks them for $5/mo — so you only pay once you outgrow free.
- No credit card required
- 500 free submissions
- Setup in minutes

