Wondering how to add a contact form to a website without hiring a developer? You need two parts: a short HTML form and a backend that emails each submission to you. Here is the route, from markup to test message.
If you are still planning the whole site, start with our guide on how to build a website.
| Item | Value |
|---|---|
| Fields in MDN’s example contact form | 3 text fields and 1 button |
| Attributes to always set on the form tag | 2 attributes: action and method |
| Netlify Forms free tier (August 2020 tutorial) | 100 form submissions per website per month |
| Netlify first paid tier (August 2020 tutorial) | $19+ at the time of writing |
The figures come from MDN’s first-form tutorial and freeCodeCamp’s Netlify Forms tutorial. Prices and limits can change, so check the source before you rely on them.
Pick the route that fits your site
According to Popupsmart’s guide, a contact form needs two parts: the form visitors fill in and a backend that receives each submission and emails it to you. The same guide adds that an HTML form can’t send email by itself, so you pair it with a form service or use your platform’s built-in form in WordPress, Shopify, Wix or Squarespace.
That leaves three practical routes:
- Platform form: switch on the form block in your site builder or CMS and you are done.
- Hosted form service: write a small HTML form and point it at a service such as Formspree or Basin.
- Host-level forms: some hosts, Netlify for example, detect your form and collect submissions for you.
If you have not picked a platform yet, a free website builder is worth a look, because Popupsmart notes that a site builder already has a contact form you can switch on. Platform forms also bring spam filtering and a place to read messages, which you would otherwise build yourself.
Build the HTML form
If you are hand-coding, MDN’s tutorial sketches a simple contact form with three text fields and one button. The form asks for a name, an email address and a message, and the button sends the data to a web server.
- Name: a single-line text input.
- Email: an input of type email, which accepts only email addresses.
- Message: a textarea for the multi-line text.
- Button: the submit control that sends everything.
Give every field a visible label tied to its input through matching for and id values. MDN says an explicit label for each control helps usability and accessibility, since clicking the label activates the field and screen readers can read it out.
Wrap the fields in a form element. MDN calls it standard practice to set at least 2 attributes: action, the URL that receives the data, and method, which for a contact form is usually post.

Connect the form to a backend
The action URL is where the form meets your backend. Basin’s beginner guide says that with a service like Basin, you put the link they give you there; without one, it points to a script on your own server.
The Formspree walkthrough in Cloudflare’s Pages docs shows the typical flow:
- Create a free account with the form service and add a new form.
- Set the recipient email to the inbox where you want submissions.
- Copy the form endpoint URL and paste it into the action attribute of your form.
- Submit a test message and confirm you land on a thank-you page.
Cloudflare’s tutorial says Formspree collects the submitted data and sends email notifications without any JavaScript or back-end coding. That makes it a good fit for a static site.
On Netlify the form needs no outside service. freeCodeCamp’s tutorial says to note the data-netlify attribute and the form name, and Netlify configures the form when it reads your site. As of that tutorial’s August 2020 date, the free tier covered 100 form submissions per website per month, with the first paid tier at $19+, so check Netlify’s current pricing before you commit.
How do you keep a contact form short and safe?
A short form gets finished more often. Basin’s guide warns that too many fields can overwhelm users and reduce the chances of them completing the form.
- Ask for less: name, email and message are enough for most small sites.
- Validate on the way in: Basin calls it crucial to validate and sanitize user input for security reasons.
- Use platform spam filters: they are one more reason to prefer a built-in form when you have one.
- Keep the labels: they cost nothing and help every visitor.
MDN makes the same point from a design angle: the bigger the form, the more you risk frustrating people and losing users. Sketch the form first and cut any field you would not miss.
Test the form before you publish
A form that looks fine can still fail silently, so send yourself a message before anyone else does.
- Fill in every field with your own details and press the button.
- Check that the message reaches your inbox, and look in the spam folder too.
- Confirm the visitor sees a thank-you page or confirmation text.
- Repeat the test on a phone, where tap targets and the keyboard behave differently.
If you add the form through an embedded script, run a website speed test before and after. That shows whether the new code made the page slower, so you can decide if the trade is worth it.
Frequently asked questions
Can an HTML form send email on its own?
Show answer
No. Plain HTML only collects the entries and posts them to a URL. Something at that address, either a form service or a script on your own server, has to receive them and forward them to your inbox.
Do I need to know how to code?
Show answer
Not on a site builder, where the form is a block you switch on. For hand-written markup, MDN lists a basic understanding of HTML as the prerequisite for its tutorial, and the code is short enough to copy and adapt.
Which fields should a contact form have?
Show answer
A name, an email address and a message box cover most small sites. Add a field such as a topic dropdown only if it helps you reply faster.
Is a contact form free to add?
Show answer
Often, at low volume. Some hosts and form services run free tiers, but limits and prices change, so read the current pricing page before you build on one.



