HTML forms

HTML input types, explained.

The type attribute turns one <input> element into a text box, a checkbox, a date picker or a button. HTML has 22 input types. Here is each one, what it is for and what the browser does with it, with links to a full tutorial for the ones contact forms use most.

Updated 7 November 2026

All 22 input types

typeUse it forWhat the browser does
textNames, short answers. The default when type is missing or unknown.Nothing beyond the attributes you add.
emailEmail addresses.Checks the value is shaped like an address; email keyboard on phones.
telPhone numbers.Dial pad on phones; no format check.
urlWebsite addresses.Requires a full URL, including https://.
numberAmounts: quantities, guests, prices.Arrows, range check with min, max and step.
passwordPasswords.Hides the characters; offers to save and suggest passwords.
searchSearch boxes.May add a clear button; some phones show a Search key.
checkboxYes or no, or any number of choices.Sends its value only when ticked.
radioExactly one choice from a few.One per name can be checked.
dateA calendar date.Date picker; sends YYYY-MM-DD.
timeA time of day.Time picker; sends HH:MM in 24-hour time.
datetime-localA date and time, without a time zone.Combined picker; sends YYYY-MM-DDTHH:MM.
monthA month and year.Sends YYYY-MM. Not supported in every browser.
weekA week of the year.Sends YYYY-W##. Not supported in every browser.
colorA colour.Colour picker; sends a hex value such as #45436f.
rangeAn approximate value on a slider.Slider between min and max; the exact number is not shown.
fileUploading files.File chooser; needs method="POST" and enctype="multipart/form-data".
hiddenValues the visitor does not see, such as an access key or subject.Sent with the form, never shown.
submitA button that sends the form.Sends the form; usually written as <button type="submit">.
resetA button that clears the form.Restores every starting value. Rarely a good idea.
buttonA button for your own JavaScript.Does nothing by itself.
imageAn image used as a submit button.Sends the form with the click coordinates.

A type the browser does not recognise falls back to text, so a newer type never breaks a form in an older browser: visitors just get a plain text box.

Form fields that are not inputs

  • <textarea> for text longer than one line, such as the message itself.
  • <select> for one choice from a long list.
  • <button> for buttons. It is easier to style than an input button and can contain icons.
  • <label> and <fieldset> name and group the fields.

Choosing the right type

The right type gives visitors the right keyboard on their phone, lets the browser fill in saved details, and catches simple mistakes before the form is sent. A few choices trip people up:

  • Phone numbers use tel, not number. A number input rejects spaces and the +, and adds arrows.
  • Codes and postcodes use text with inputmode="numeric" if they are digits only, so leading zeros survive.
  • Dates use date when visitors pick a day, but a plain text field is often easier for a date far in the past, such as a date of birth.
  • range hides the exact number. Use it when an approximate value is fine, and show the current value next to it if it matters.
HTML
<label for="start">Preferred start date</label>
<input id="start" type="date" name="start_date" min="2026-01-01" />

<label for="budget">Budget</label>
<input id="budget" type="range" name="budget" min="1000" max="20000" step="1000" />

Attributes every input shares

  • name: the key the value is sent under. An input without a name is not sent.
  • id: what a label’s for connects to.
  • value: the starting value, or the value a checkbox or radio button sends.
  • required: must be filled in before the form will send.
  • disabled: cannot be used, and is not sent. readonly: cannot be changed, but is still sent.
  • autocomplete: tells the browser which saved detail fits, such as name, email or tel.
  • placeholder: an example shown while the field is empty. It is not a label.

For the checks the browser runs with these, see HTML form validation.

A form that sends

This enquiry form uses six of the field types above and posts to Heartdove, which saves every message, emails you an alert and tracks it until it is delivered or bounces. Every field arrives as text under a readable version of its name, such as “Start date: 2026-12-01”. Heartdove accepts text fields only, so leave file inputs out; up to 50 fields, each up to 10,000 characters.

enquiry.html
<form action="https://submit.heartdove.com/v1/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" />
  <input type="hidden" name="subject" value="Project enquiry" />

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

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

  <label for="phone">Phone (optional)</label>
  <input id="phone" type="tel" name="phone" autocomplete="tel" />

  <label for="website">Current website (optional)</label>
  <input id="website" type="url" name="website" placeholder="https://" />

  <label for="start">Preferred start date</label>
  <input id="start" type="date" name="start_date" />

  <label for="message">Project details</label>
  <textarea id="message" name="message" rows="5" required></textarea>

  <input type="checkbox" name="botcheck" tabindex="-1" autocomplete="off" style="display:none" />
  <button type="submit">Send enquiry</button>
</form>

Replace YOUR_ACCESS_KEY with your key from a free Heartdove form, or build a form from these field types in the contact form generator.

Questions

How many input types are there in HTML?

22: button, checkbox, color, date, datetime-local, email, file, hidden, image, month, number, password, radio, range, reset, search, submit, tel, text, time, url and week.

What is the default input type?

text. An input with no type, or a type the browser does not recognise, is a plain text box.

Is textarea an input type?

No. A multi-line text box is its own element, <textarea>, written with an opening and closing tag. There is no type="textarea".

Is there an input type for a dropdown?

No. A dropdown is the <select> element. For suggestions while typing, use an input with a <datalist>.

Which input type should I use for a phone number?

type="tel". It shows a dial pad on phones and accepts the spaces and + people use in phone numbers.

Never lose another enquiry.

Connect your first form in a few minutes. Your existing design stays exactly as it is.