splitforms.com

HTML · FORM CONTROL

HTML input: all 22 types, attributes and what each sends

The HTML <input> element is a form control whose type attribute decides what it accepts, how the browser validates it and what it submits. Types include text, email, password, number, checkbox, radio, file and date. An input is only submitted if it has a name attribute.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

input-example.html
<label for="email">Email</label>
<input type="email" id="email" name="email" required>

Want this form to email you its submissions? Point it at a free splitforms endpoint, with no server to build. Get a free access key →

All input types

What are the HTML input types?

The HTML Standard defines 22 input types. The type sets the control, the keyboard a phone shows, the check the browser runs before submit and the exact string the field sends. A missing or misspelled type falls back to text.

What are the HTML input types?
typeMobile keyboard or UIBuilt-in validationSubmitted valueGuide
textStandard keyboardOnly what you add: required, minlength, maxlength, patternThe text, with line breaks removedinput type=text
searchKeyboard whose enter key may read SearchSame as textThe text, with line breaks removedinput type=search
emailEmail keyboard, typically with an @ keyMust look like name@domainThe address with outer spaces trimmed; with multiple, a comma-separated listinput type=email
urlURL keyboard, often with a / keyMust be an absolute URL such as https://example.comThe URL with outer spaces trimmedinput type=url
telTelephone keypad: 0–9, * and #None: any text passes, so add pattern for a formatThe text as typedinput type=tel
passwordStandard keyboard, characters maskedSame as textThe text as typed, in plain text (serve the form over HTTPS)input type=password
numberNumeric keyboardBlocks non-numbers; checks min, max and stepA number string such as 2.5; empty when left blankinput type=number
rangeSlider, no keyboardNothing to fix: the value is kept between min and max (default 0 to 100)A number string; the midpoint unless value sets oneinput type=range
dateNative date pickerMust be a real date; checks min, max and stepyyyy-mm-dd, e.g. 2026-10-02input type=date
timeNative time pickerMust be a valid time; checks min, max and stepHH:mm, or HH:mm:ss with secondsinput type=time
datetime-localNative date and time pickerMust be a valid date and time; checks min, max and stepyyyy-mm-ddTHH:mm, with no time zoneinput type=datetime-local
monthMonth picker where supported; not Baseline, other browsers show a text boxMust be a valid month where supportedyyyy-mminput type=month
weekWeek picker where supported; not Baseline, other browsers show a text boxMust be a valid week where supportedyyyy-Www, e.g. 2026-W40input type=week
colorNative color pickerNothing to fix: a color is always pickedLowercase hex such as #ff4f00; never emptyinput type=color
checkboxTap to toggleWith required, it must be checkedIts value (or on) when checked; nothing when uncheckedHTML checkbox
radioTap to pick one of a groupWith required, one radio in the group must be pickedThe picked radio's value; nothing when none is pickedHTML radio button
fileFile picker, or the camera with captureWith required, a file must be chosen; accept is not checkedThe file with multipart/form-data, otherwise only its filenameHTML file input
hiddenNot shownNoneIts value, exactly as writteninput type=hidden
submitButtonNoneIts name=value, only when it is the button that submitted the forminput type=submit
imageImage used as a submit buttonNoneThe click position as name.x and name.y, only when it is the button that submitted the forminput type=image
resetButtonNoneNever submittedinput type=reset
buttonButtonNoneNever submittedinput type=button

Keyboards follow the hints in MDN's inputmode reference; the exact layout depends on the phone's operating system and keyboard app. The Submitted value column is the string each field puts in the request; to send those values yourself as URL-encoded, multipart or JSON, see how to send form data to an API. To make a field mandatory, see the HTML required attribute.

Sources: WHATWG HTML Standard: the input element · WHATWG HTML Standard: constructing the entry list · MDN: <input> types · MDN: inputmode

Copy-paste code

HTML Input code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

input.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

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

  <label for="email">Email</label>
  <input type="email" id="email" name="email" placeholder="you@example.com" required>

  <label for="phone">Phone</label>
  <input type="tel" id="phone" name="phone" placeholder="+1 555 000 0000">

  <label for="qty">Quantity</label>
  <input type="number" id="qty" name="quantity" min="1" value="1">

  <label for="when">Preferred date</label>
  <input type="date" id="when" name="preferred_date">

  <input type="checkbox" name="botcheck" style="display:none">
  <button type="submit">Send</button>
</form>

Submission and autofill

How do type, name, autocomplete and autofill differ?

The type attribute controls the input's UI, validation and value format; name is the key used when the form is submitted; and autocomplete identifies the saved information a browser may offer. Browser autofill is the browser's action of inserting that saved data; it does not replace the input's type or name.

How do type, name, autocomplete and autofill differ?
FeatureWhat it controlsExample
typeThe control, mobile keyboard, built-in validation and value formattype="email" displays an email control and checks its format
nameThe key paired with the value in the submitted form dataname="email" submits the value under the email key
autocompleteWhich saved profile or credential the browser can suggestautocomplete="email" asks for the visitor's saved email address
Browser autofillWhen the browser inserts saved data and applies its autofilled-field stylingChrome fills a saved address and may tint the input yellow or blue

The yellow or blue tint is a visual signal from autofill, not an input type. To match it to your design, follow how to change the autofill background color with CSS.

Attributes by type

Which attributes work with which input types?

Most input attributes apply to only some types: pattern does nothing on a number field and accept does nothing outside type="file". A browser ignores an attribute that does not apply, so it will not warn you. name, value, disabled and form work on every type.

Which attributes work with which input types?
AttributeWorks on these typesWhat it does
requiredtext, search, url, tel, email, password, number, date, time, datetime-local, month, week, checkbox, radio, fileBlocks the submit until the field has a value, or the box is checked. See the required attribute.
placeholdertext, search, url, tel, email, password, numberA hint shown while the field is empty. It is not a label. See placeholder.
patterntext, search, url, tel, email, passwordA regular expression the whole value must match. See pattern.
minlength, maxlengthtext, search, url, tel, email, passwordThe shortest and longest value allowed, counted in characters. See minlength and maxlength.
sizetext, search, url, tel, email, passwordVisible width in characters. Style the width with CSS instead.
min, max, stepnumber, range, date, time, datetime-local, month, weekThe lowest value, the highest value and the allowed increments between them. See min and max and step.
readonlytext, search, url, tel, email, password, number, date, time, datetime-local, month, weekThe person cannot edit the value, but it is still submitted. A readonly field skips validation. See readonly.
listtext, search, url, tel, email, number, range, date, time, datetime-local, month, week, colorThe id of a <datalist> that supplies suggestions. See datalist.
autocompletetext, search, url, tel, email, password, number, range, date, time, datetime-local, month, week, colorTells the browser what to autofill, such as email or given-name. See autocomplete.
multipleemail, fileEmail takes a comma-separated list of addresses; file takes several files. See multiple.
accept, capturefileFilter the file picker; capture opens the camera on phones. See file input.
checkedcheckbox, radioStarts the control selected. See checkbox.
src, alt, width, heightimageThe picture used as the submit button, its alternative text and its size.
formaction, formmethod, formenctype, formnovalidate, formtargetsubmit, imageOverride the form's own action, method, enctype, novalidate and target for this one button. See formaction and form target.

Compiled from the HTML Standard's table of input type attribute applicability; the full matrix also lists the newer color attributes alpha and colorspace.

Sources: WHATWG HTML Standard: input type attribute summary · MDN: <input> attributes

Attributes · <input>

Which HTML Input attributes matter?

These attributes decide how the <input> behaves and what actually gets emailed to your inbox when someone submits.

HTML Input attributes and what each one does
AttributeWhat it doesDocs
typeSets the control: text, email, tel, number, date, file, checkbox, radio, password, hidden, submit, and more.MDN
nameThe key the value is submitted under. Without it, the field is not sent at all.MDN
valueThe initial value. For text fields it's the default text; for checkbox/radio it's what gets sent when checked.MDN
placeholderA short hint shown when the field is empty. It is not a substitute for a <label>.MDN
requiredBoolean. The browser blocks submit and shows a hint if the field is empty.MDN
min / max / stepConstraints for number and date inputs. The browser validates against them.MDN
patternA regex the value must match. Pair it with a title= explaining the required format.MDN
autocompleteHints like "email", "tel", "given-name" that let browsers autofill correctly.MDN
idLinks the field to its <label for> and to CSS and scripts. It is never submitted; only name is.MDN
disabledBoolean. The field can't be edited, skips validation and is left out of the submission.MDN
readonlyBoolean. The field can't be edited but is still submitted. Works on text-like, number and date types.MDN
minlength / maxlengthThe shortest and longest text allowed, in characters. Re-check lengths on the server.MDN
multipleBoolean, for email and file only: accept several addresses or several files.MDN
acceptFor type="file" only: the file types the picker shows, e.g. .pdf or image/*.MDN
listThe id of a <datalist> whose options are offered as suggestions while typing.MDN
formThe id of a <form> elsewhere on the page, for a field that sits outside the form element.MDN

Common mistakes

HTML Input not working? Here's why.

Most broken forms come down to a few small mistakes with the <input>. Check these before you ship, then forward every submission to Slack or a webhook.

  1. No name = no data

    An input without name= is dropped from the submission. id only wires up <label for> and anchors.

  2. type=email only checks format

    It validates the shape (a@b.co) but not whether the address is real or deliverable. Validate deliverability server-side.

  3. placeholder is not a label

    Placeholders vanish on focus and hurt accessibility. Always include a real <label> linked with for=.

  4. A misspelled type quietly becomes text

    type="emial" or any type a browser does not know falls back to text: no error, but the field loses its keyboard and its validation. Check the spelling against the input types table above.

  5. disabled fields are never sent

    A disabled input is left out of the submission and skips validation. To show a value people can't change but you still receive, use readonly instead.

Sources: WHATWG HTML Standard: <input> · MDN: <input>

Key benefits

Copy-paste ready

The HTML Input example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html input form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <input> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Input to any page.

Copy the html input example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

  1. Copy the code

    Copy the HTML Input example below.

  2. Add your access key

    Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

  3. Paste into your site

    Drop the form into any HTML page. Submissions arrive in your dashboard.

Questions

HTML Input questions, answered.

Anything missing? Email us, we read every message.

A person reading answers to common questions
What is the HTML input tag?

The <input> element is an HTML form control that lets users enter data. Its type attribute decides what kind of control it is (text, email, number, date, file, checkbox, radio and others), each with its own built-in validation and mobile keyboard.

Does the input tag need a closing tag?

No. <input> is a void element: it has no content and no closing tag, so </input> is invalid. In HTML, <input> and <input /> are both fine. JSX (React) requires the self-closing form, <input />.

What are the HTML input types?

The HTML Standard defines 22: text, search, email, url, tel, password, number, range, date, time, datetime-local, month, week, color, checkbox, radio, file, hidden, submit, image, reset and button. Each changes how the field behaves, validates, renders on mobile and what value it submits. A missing or unknown type falls back to text.

What are the attributes of the input tag?

The common ones are type, name, value, id, placeholder, required, disabled, readonly, min, max, step, minlength, maxlength, pattern, autocomplete, multiple, accept, list and form. Which ones apply depends on the type: pattern works only on text-like types and accept only on type="file". The attributes-by-type table on this page lists the full mapping.

What value does each input type submit?

Text-like types send the text as typed, number and range send a number string, date sends yyyy-mm-dd and color sends lowercase hex like #ff4f00. A checkbox or radio sends its value only when checked, a file sends the file only with enctype="multipart/form-data", and reset and button inputs are never sent.

How do I make a text input in HTML?

Use <input type="text" id="name" name="name"> with a <label for="name"> beside it. text is also the default type, so leaving type out gives the same single-line field. Add required, minlength, maxlength or pattern to validate it, and placeholder for a hint that never replaces the label.

Show 8 more questions
What is the use of the input tag?

The input tag collects a single value from the user, such as a name, an email address, a number or a chosen file, and submits it under its name attribute when the form is posted to a server or form backend.

How do I change the width of an input?

Use CSS: input { width: 100%; max-width: 24rem; box-sizing: border-box; }. The size attribute also sets a width in characters on text-like types, but CSS gives you exact control and responsive layouts. Avoid fixed pixel widths that overflow on phones.

How do I allow file uploads in HTML?

Use <input type="file" name="resume">, add enctype="multipart/form-data" to the <form>, and post to a backend that accepts files (splitforms supports uploads on paid plans with storage connected).

Why is my input value not submitting?

Almost always because the input is missing a name= attribute, the field is disabled, or it sits outside the <form>. Check that name= is set and the control is inside the form element.

What is the difference between input type, name and autocomplete?

type decides the control, validation and value format, name identifies the field in submitted form data, and autocomplete tells the browser which saved information to suggest. For example, an email field can use type="email", name="email" and autocomplete="email" together; each attribute has a different job.

Why is my input background yellow?

A yellow input background is usually the browser's autofill style, not your normal CSS. Chrome, Edge and Safari tint fields after inserting saved data so visitors can see what was filled. Keep autofill enabled and style the :autofill or :-webkit-autofill state instead of disabling autocomplete.

Which autocomplete value should I use?

Use the token that matches the saved information: autocomplete="name" for a full name, "given-name" and "family-name" for separate name fields, "email" for email, "tel" for phone and "street-address" for a street address. Use "current-password" for a login password and "new-password" when creating or changing a password.

Does browser autofill change what an input submits?

Autofill changes the field's value, but it does not change the name key used in the submission or the behavior selected by type. The browser submits the filled value under the input's name, subject to the same validation and form rules as a typed value.

View all FAQs

Make this form actually submit.

Point your form at splitforms. 500 free submissions a month, spam filtering, webhooks on paid plans — no server.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form