Website forms · 17 Nov 2026 · 7 min read
Website contact form: fields, spam protection and follow-up
A contact form should ask for little, resist spam and always tell the visitor what happens next. Here is how to set one up properly.
The short answer
A good website contact form asks only for what you need to reply, usually a name, a reply address and a message. Block spam with layers such as a hidden trap field and server side checks, and always confirm receipt on the page and by email, then route the message to a shared mailbox someone watches.
What a contact form is for
A website contact form turns a visitor's question into a message you can answer, in a format you control. It does three jobs. It lets people reach you without opening their own email, it gives you the details you need to reply, and it keeps your address out of public view where scrapers can collect it.
It also has a cost. Every field is a small effort for the visitor, and every public form attracts automated junk. Good contact form best practices are mostly about balancing those two facts: ask for as little as you need, and protect the inbox that receives the answers.
This guide covers the fields, the spam, and the part most sites forget, which is what happens after someone presses send.
How many fields should a contact form have?
As few as let you reply usefully. There is no magic number, because it depends on what the form is for. A general enquiry form needs less than a request for a quote.
Start from the reply. What do you need to know before you can write back without a second round of questions? For many businesses the answer is a name, a way to reply and a message box. A phone number field is optional unless you actually call people. If you ask for it, say what you will use it for.
Add a field only when it changes your answer. A service area, a product type or a preferred date can be worth asking about. A job title, a company size or a "how did you hear about us" question usually is not, at least on the first contact. You can ask these in your reply.
- Mark which fields are required and which are optional, and keep required ones to a minimum.
- Use a dropdown only when the answers are a short, fixed list. Otherwise a text box is easier.
- Give the message box enough height that people do not feel they must write a single line.
- Use the right input type for email and phone fields, so mobile keyboards show the correct keys.
Test it on a phone. Most contact forms are completed on small screens, with thumbs, often in a hurry.
Labels, errors and access
Each field needs a visible label above or beside it, not just placeholder text that disappears when the visitor starts typing. Error messages should say what went wrong and where, in words, next to the field. A red border alone tells a colour blind visitor nothing.
These points also decide whether keyboard and screen reader users can use the form at all. We cover them in detail in our guide to form accessibility: labels, errors and keyboard use. A form that cannot be completed without a mouse loses real enquiries, and nobody tells you.
Keep the button text specific. "Send message" tells the visitor what happens. A bare "Submit" does not. Do not clear the fields if there is an error, since losing a typed message is the quickest way to lose the enquiry.
How to stop spam submissions
Any public form will receive automated junk sooner or later. The aim is to block the bots without making real people work for it. Several layers work better than one heavy one.
A hidden trap field
Add a field that people never see but simple bots fill in. If it arrives filled, discard the message. This costs real visitors nothing, and it stops a lot of basic automated submissions.
Server side checks
Never rely on checks that run only in the visitor's browser, because a bot can skip them. Validate the email format, the length of the message and the presence of required fields on the server. Reject messages with many links if that fits your business.
Rate limits and timing
A form completed in a fraction of a second was not filled in by a person. A single address sending many messages in a short time is also a sign. Slow or block both.
A challenge service
Challenge tools ask the visitor or their browser to prove they are human. Some are invisible and some show a puzzle. They work, but they add friction and can cause accessibility problems, so choose carefully and test with a keyboard and a screen reader. Check the current documentation of whichever service you use for privacy and consent notes, since they often involve third party scripts. Our guide to CAPTCHA and spam protection for website forms compares the approaches in more detail.
Whatever you choose, keep a record of what gets blocked for the first few weeks. If real people are being caught, relax the rule.
What should happen after someone submits
This is where most forms fall short. The visitor presses the button and then has to guess whether it worked. Fix that in four places.
On the page
Show a clear confirmation, either a message in place of the form or a short thank you page. Say what will happen next and when they can reasonably expect it, without promising a time you cannot keep. A separate thank you page also gives you a clean spot to count completed enquiries in your analytics.
In their inbox
Send an automatic email that confirms receipt and repeats what they wrote. It reassures them, and it gives them a record. Send it from an address that can receive replies, and make sure your domain's email settings are right so it does not land in spam.
In yours
The notification to your team should contain every field, the page the form was on and the date, so that whoever replies has the context. Send it to a shared mailbox rather than one person's, so enquiries are not stuck when someone is away. If you also store submissions in the site, so they survive a lost email, remember that they contain personal data and need sensible handling.
In your process
Decide who answers, how fast you aim to, and where the enquiry is logged. A form that sends mail to an unwatched inbox is worse than no form. Check the whole route once a month by submitting a test message and following it through.
Privacy and consent on the form
If the form collects personal details, tell people how they will be used. A short line under the button that links to your privacy policy is the usual approach. Do not sign people up to marketing email by default through a pre-ticked box. Rules on consent differ by country and change, so ask a qualified lawyer what applies where your customers live.
Keep the data you collect proportionate. Fewer fields means less to protect and less to explain. When a form uploads files, such as images, check type and size on the server and tell the visitor which files are accepted.
Testing before and after launch
Test the form like a visitor, then like an attacker. Submit it with a valid message, an empty one, a very long one and one with an invalid email. Try it on a phone and with a keyboard only. Confirm the notification arrives, the auto reply arrives, and the thank you page loads. Do this on a copy of the site first. Our guide to the staging site explains why a safe test copy saves trouble.
After launch, look at the numbers. How many people reach the form and how many finish? A big gap suggests too many fields, a broken button or a confusing error. Our guide to getting more form submissions goes further into layout and wording.
Forms also break quietly when the site changes. A new plugin, a theme update or a hosting change can stop messages from sending without any visible error. If that is a risk for you, read about when fixing is enough and when to redesign, and agree in your website development contract who tests the forms after changes. For help building or repairing forms, see our website development service. Images on the contact page matter too; see the guide to image formats if the page loads slowly.
Related guides
- Website development
- Website maintenance vs redesign when fixing is enough
- Staging site what it is and why to use one
- Website development contract what to agree
- Website Image Formats: WebP, AVIF, JPEG and PNG Compared
- Website Form Accessibility: Labels, Errors and Keyboard Use
Questions and answers
How many fields should a contact form have?
Only as many as you need to reply usefully. For many businesses that is a name, a reply address and a message. Add a field only if it changes your answer, and mark which fields are optional. Test the form on a phone.
How do I stop spam submissions on a contact form?
Use layers: a hidden trap field, server side validation, timing and rate limits, and if needed a challenge service. Never rely on browser-only checks. Review what is blocked for a few weeks to be sure real enquiries are not caught.
What should happen after someone submits a contact form?
They should see a clear confirmation on the page, get an automatic email that repeats their message, and your team should receive every field in a shared mailbox. Decide who replies and how quickly you aim to, then test the route monthly.
Should I use a contact form or just show an email address?
A form keeps your address out of public view and gives you structured details, but it needs spam protection and testing. An email link is simpler but invites scrapers. Many sites offer both, so visitors can choose.
Do I need a privacy notice on my contact form?
If you collect personal details, tell people how they will be used and link to your privacy policy. Consent rules differ by country and change, so ask a qualified lawyer what applies to your business.
Why are my form messages not arriving?
Common causes are a changed email setting on your domain, a plugin or theme update, messages landing in spam, or a full mailbox. Submit a test, check spam folders and check the form settings. Ask your developer to check mail delivery.
Tell us what you are building.
A short call, a written plan and a fixed quote. No obligation.