Back to blog

January 15, 2026 · NBForms Team

HTML Form Backend: How to Add a Contact Form Without a Backend

A form backend is just an endpoint willing to accept the POST your <form> already sends. Here's exactly how that works, what it can't do, and when to reach for one.

Search "how to add a contact form without a backend" and you'll find dozens of nearly identical posts — because the underlying trick really is that simple, and every form-backend service (this one included) ends up writing the same core example. What's worth actually understanding is why it works, not just the four lines of HTML to copy.

Lines of HTML code on a screen Photo by Florian Olivo on Unsplash

What "form backend" actually means

A <form> element doesn't care what's on the other end of its action attribute. Browsers have submitted forms to arbitrary URLs since the 1990s — the only thing that changed is that for a long time, "arbitrary URL" meant "a server you wrote and deployed yourself." A form backend is just a service willing to be that URL for you: it accepts the POST request, stores whatever fields arrived, and does something useful with them (email you, save them to a dashboard, forward them somewhere else) — all without you writing or hosting a line of server code.

<form action="https://api.nbforms.com" method="POST">
  <input type="hidden" name="_token" value="YOUR_TOKEN" />

  <label>Name</label>
  <input type="text" name="name" required />

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

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

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

That's a complete, working contact form for a fully static site. The hidden _token field is what ties the submission back to your account — generated once, from the form's setup page — and every other field name becomes a column in your submissions dashboard automatically. There's no schema to define ahead of time and no API to write: add a field to the HTML, and it shows up as data on the next submission.

What happens after someone hits submit

When a visitor fills this in and sends it, NBForms:

  • Stores the submission, keyed by the field names you chose, in a dashboard you can search.
  • Emails an alert to whichever address (or addresses) you've configured, with CC support if more than one person needs to see it.
  • Runs the submission through server-side spam filtering automatically, before it reaches your inbox at all — no CAPTCHA widget required for this to happen.

None of that touches infrastructure you manage. The static site stays exactly as static as it was before you added the form.

Redirecting — or not — after submit

Left alone, a plain form like the one above navigates the browser to whatever the action URL returns, which usually isn't what you want a visitor to see. Set a redirect URL in the form's settings and NBForms sends them to your own thank-you page after a successful submission instead — or skip the redirect and show a custom success message on the same page if that fits your site better.

Static HTML, or a framework

Everything above works with a plain, unenhanced <form> tag — no JavaScript required, which is the whole appeal for a static site. If the site is built with React, Vue, Svelte, Next.js, or similar, submitting via fetch and a FormData object gets you loading states and inline error handling without a full page navigation — the endpoint and field names are identical, just sent with JavaScript instead of a native form submission. There are ready-made snippets for 16 frameworks covering this, so the fetch call doesn't need to be written from scratch.

If there's no site to embed a form into at all yet, a hosted form page skips the embedding step entirely.

What this pattern can't do

Worth being direct about, since it's easy to assume a service like this does more than it does: a form backend accepts and stores structured submissions — it doesn't run your business logic. There's no payment processing, no multi-step conditional form wizard, and no automated reply sent back to whoever submitted (only an alert to you, plus whatever success message or redirect you've configured). For anything past "collect this data and tell me about it," that logic still lives in whatever you connect the data to afterward — a webhook, Zapier, Make, or a system you already run.

The short version

A contact form doesn't need a backend if something else is willing to be the backend. Point a plain <form action="..."> at an endpoint built to store submissions, filter spam, and alert you, and a fully static site collects real, structured leads — no server to patch, monitor, or pay to keep running beyond the form itself.

Frequently asked questions

Is a form backend service secure?

Submissions travel over HTTPS to the endpoint the same way they would to a server you wrote yourself, and server-side spam filtering runs on every submission automatically. The one thing worth checking on any form backend, NBForms included, is that field values get sanitized before they're ever shown back to you in a dashboard — otherwise a malicious submission could try to inject something into your own admin view.

Does this work if my site has literally no server at all — just files on a CDN?

Yes — that's exactly the case this pattern is for. The static files never need to run any code; the browser sends the POST request straight to the form backend's endpoint, bypassing your hosting entirely.

Can I validate fields before they're submitted?

Client-side validation (required, type="email", pattern attributes, or your own JavaScript) still works exactly like it does on any HTML form, since none of that changes. Server-side, NBForms enforces required fields you've configured and rejects submissions missing them, but it doesn't run custom validation logic beyond that.

Does a form backend support file uploads?

Yes, using a standard <input type="file"> field (add multiple for more than one file) inside a form with enctype="multipart/form-data" — no separate upload service or signed URL flow to wire up.

What happens if I exceed my monthly submission quota?

Forms don't silently drop submissions — you get a clear signal you're over the free tier and can top up with pay-as-you-go credits. There's no surprise data loss.