Guides / Static Hosting
How to Add a Working Form to an HTML Website
To make a form on an HTML website work, the form needs somewhere to send its data. A static website has no server of its own, so there are three ways: use your host's built-in form handling, point the form's action at a form service, or write a small server function. On Static.app you add one attribute, static-form, to the <form> tag, and entries arrive in your dashboard and by email.
Why an HTML form does nothing on its own
An HTML form only collects what people type. When someone presses the button, the browser sends the fields to the address in the form's action attribute. On a static website nothing at that address is waiting to receive them, so the entry is lost or the visitor sees an error page.
A mailto: address as the action looks like a shortcut, but it opens the visitor's own email app instead of sending anything. Many visitors have no email app set up, and you receive nothing from them.
Three ways to make the form work
1. Your host's built-in forms
Some hosts collect form entries for you, so you keep your HTML and add a marker to the form. As of mid 2026, Static.app and Netlify include form handling. GitHub Pages, Vercel, Cloudflare Pages and Render have none built in, so on those you use one of the next two methods.
2. A form backend service
A form backend gives you an endpoint address. You set it as the form's action, and the service stores entries and emails them to you. It works on any host. Check the free tier's monthly limit and whether entries carry the service's branding.
<form action="https://forms.example.com/your-form-id" method="POST">
3. Your own server function
On hosts with serverless functions you can write a small function that receives the form and sends an email or saves the entry to a database. It gives you full control, and it means writing and maintaining code, an email provider and spam checks yourself.
How to add a working form on Static.app
Static.app turns any HTML form into a working one with the static-form attribute. You need no endpoint and no script: when a page contains a form, Static.app adds its form script for you.
- Add
static-formto the<form>tag, and give every field aname. The name is what labels each answer in your entries. - Optionally, name the form with
static-form-id, so entries from several forms stay apart. - Upload the website. The form starts collecting entries right away.
<form static-form static-form-id="contact"
static-form-success-message="Thanks, we got your message.">
<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>
<button type="submit">Send</button>
</form>
<p id="static-success-message"></p>
After a successful send, the fields are cleared, the button says "Done!", and the text in static-form-success-message appears in the element with the id static-success-message. To run your own code instead, name a function in static-form-success-callback.
Where the entries go
- The dashboard: every entry is listed under your website's Forms, where you can read, delete and export them.
- Email: tick Enable email notifications in the form settings and add the addresses that should get each entry. Each address confirms once before mail is sent to it.
Keep spam out
In the form settings you can add a honeypot field, a hidden field that only bots fill in, and turn on Enable reCAPTCHA v3 with your own keys. For signup forms, the guide on stopping fake signups goes further.
Common questions
Can a static website have a working contact form?
Yes. The page stays static, and the entries are sent to a service that stores them: your host's form handling, a form backend or your own function. On Static.app it is the static-form attribute.
Do I need JavaScript to make the form work?
Not of your own. On Static.app the form script is added automatically to any page with a form. With a form backend service, a plain HTML form with an action works without any script.
Can I get form entries by email?
Yes. On Static.app, turn on email notifications in the form settings and add the addresses that should receive each entry.
Does the form work on my own domain?
Yes. A form with the static-form attribute works on the free staticdomains.app address and on your own domain.
Ready to try it?
Add forms to your website