Put a plain HTML form on your page and set its action to a form endpoint. Cloudflare Pages serves the page, the endpoint receives the form, and you get the message by email. There is no function to write.
You could handle the form in a Pages Function of your own. That means writing the code that reads the form, filters spam, stores the message and sends the email. A form backend is that code, already running.
Steps
- Get a form endpoint. In FormTango, create a free account, add a form and copy the endpoint from its Setup tab.
- Add the form below to your page.
- Commit and push, or upload the site, so Pages deploys it.
- Open the deployed page and send one message. Check it on a preview deployment first if you use them.
The form
<form action="https://formtango.com/f/YOUR_FORM_ID" method="POST">
<label>Name <input type="text" name="name" required></label>
<label>Email <input type="email" name="email" required></label>
<label>Message <textarea name="message" required></textarea></label>
<input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<button type="submit">Send</button>
</form>
Form endpoint or your own function?
| Form endpoint | Your own function | |
|---|---|---|
| Code to write | None | Reading the form, validation, storage, email |
| Secrets to manage | None | An email service key, kept in environment settings |
| Spam filtering | Included | Yours to build |
| Where submissions are kept | An inbox you can search | Wherever you store them |
| Best when | You want a working form today | The form must run custom logic on your side |
Works with any framework on Pages
Because the browser posts straight to the endpoint, it makes no difference whether the site is plain HTML or built with a framework. There are guides for Astro, Next.js, SvelteKit, Hugo and Eleventy, and a short Cloudflare Pages guide.
After the form is sent
A plain post takes the visitor to a thank-you page. On FormTango's paid plans, a hidden _redirect field sends them to your own page. To keep them on the page, send the form with fetch: see how to submit a form with fetch. The free plan covers 1,000 submissions a month with unlimited forms. Paid plans start at $9 a month.
If it does not work
- A 404 from the endpoint means the form id in the action is wrong.
- An empty submission means the inputs have no name attributes.
- If you have a function or redirect rule that catches every path on your site, make sure the form's action is the full outside address and not a relative one.
- Paste the markup into the form checker to rule out the simple mistakes.
Common questions
- Do I need a Pages Function for a contact form?
- No. A plain HTML form that posts to a form backend works on Cloudflare Pages with no function and no server code.
- Will the form keep working if I move hosts?
- Yes. Nothing about the form is tied to the host. The same HTML works on any static host.
- Do I need to add a CAPTCHA?
- Usually not. Add the hidden _gotcha field and let the form backend filter spam. Add a CAPTCHA only if spam still gets through. See [honeypot vs CAPTCHA](/blog/honeypot-vs-captcha).
Written by the FormTango team. Facts about other services were read from their own pages on November 22, 2026. Spotted something out of date? Tell us and we will fix it.