HTML form elements, with live examples.
HTML form elements are the tags that build a form: <form> wraps the fields, <input>, <select> and <textarea> collect values, and <label>, <fieldset> and <button> name, group and submit them. Each page below has a live example you can edit in the browser, a copy-paste snippet, the attribute table and the common mistakes.
All 65 HTML form elements
Form elements 14
The tags that build a form: form, input, select, textarea, label, button and friends.
HTML Form
The container that collects fields and sends them to its action URL with GET or POST.
Read & copyHTML Input
One form field; its type (text, email, number, file and more) sets what it accepts and sends.
Read & copyHTML Textarea
A multi-line text field for messages and comments, sized with rows and cols.
Read & copyHTML Select (Dropdown)
A dropdown list built from option tags that submits the chosen option's value.
Read & copyHTML Button
Submits the form, resets it or runs a script, depending on its type attribute.
Read & copyHTML Label
Names a form field; its for attribute matches the field's id so a click focuses it.
Read & copyHTML Fieldset & Legend
Groups related controls under a legend caption; disabled on it disables them all.
Read & copyHTML datalist
A list of suggested values for an input, linked through the input's list attribute.
Read & copyHTML output Element
Shows a live result from a calculation or another control, such as a range slider.
Read & copyHTML Optgroup
Groups related <option> elements under a non-selectable label inside a <select>.
Read & copyHTML Progress Bar
Shows how far a task has got: value out of max, or an indeterminate busy bar when value is left out.
Read & copyHTML Meter Element
A gauge for a measurement in a known range, such as disk usage, a score or password strength, coloured by low/high/optimum.
Read & copyHTML Legend Element
The caption of a <fieldset>: it must be the first child and names the whole radio or checkbox group for screen readers.
Read & copyHTML Dialog Element
A native modal or popup box. With <form method="dialog"> inside, submitting closes it and sets returnValue instead of sending a request.
Read & copyInput types 22
Every type value for <input>, from text and email to date, range and file.
HTML Radio Button
Pick exactly one option; radios that share a name form one group.
Read & copyHTML File Input (Upload)
Lets people choose files to upload; needs POST and multipart/form-data.
Read & copyHTML Checkbox
An on/off box that sends name=value only when it is checked.
Read & copyHTML Date Input
A native date picker that always submits the date as yyyy-mm-dd.
Read & copyHTML Email Input
A text field the browser checks for one @ and a valid domain shape before submit.
Read & copyHTML Input Type Tel
A phone number field that opens the phone keypad on mobile but doesn't check the format.
Read & copyHTML Input Type Number
A field for amounts and counts that blocks non-numbers and checks min, max and step.
Read & copyHTML Input Type URL
A website field that opens the URL keyboard on mobile and only accepts absolute URLs.
Read & copyHTML Input Type Hidden
An input the visitor never sees that still sends its name and value with the form.
Read & copyHTML Input Type Password
A text field that hides what is typed; the value is still sent as plain text.
Read & copyHTML Input Type Range
A slider input for picking a number within a range.
Read & copyHTML Input Type Time
A time picker input that submits the time as HH:MM in 24-hour format.
Read & copyHTML Input Type Search
A text field for search queries, with a clear button and a search key on mobile keyboards.
Read & copyHTML input type=color
A native color picker that always submits a 7-character lowercase hex value like #ff6600.
Read & copyHTML input type=datetime-local
A date and time picker that submits a local wall-clock time with no time zone.
Read & copyHTML input type=month
A picker for a year and month that submits the value as YYYY-MM.
Read & copyHTML input type=week
A picker for an ISO week that submits the value as YYYY-Www, such as 2026-W45.
Read & copyHTML Input Type Submit
A void submit control whose value attribute is the button label; only the clicked input sends its name=value pair.
Read & copy<input type="text">
A single-line text field for free-form input such as a person's name.
Read & copy<input type="reset">
A button that restores every control in its form to the default value written in the HTML, not to blank.
Read & copy<input type="button">
A plain clickable button that does nothing until JavaScript runs; it never submits or resets the form and its value is not sent.
Read & copyHTML Input Type Image
A graphical submit control: src and alt are required; a click sends name.x and name.y coordinates instead of a name=value label.
Read & copyAttributes 29
The attributes that control validation, submission and the keyboard.
HTML Required Attribute
Makes a field mandatory: the browser blocks the submit until it has a value.
Read & copyHTML Pattern Attribute
A regular expression the whole value of a text-like input must match before submit.
Read & copyHTML Autocomplete Attribute
Tells the browser which saved value (name, email, address, one-time code) fits a field.
Read & copyHTML Form Method (GET vs POST)
GET puts the form data in the URL; POST sends it in the request body.
Read & copyHTML Form Enctype Attribute
How a POST form encodes its data: urlencoded (default), multipart/form-data for files, or text/plain.
Read & copyHTML novalidate Attribute
Turn off the browser's built-in form checks for a whole form, or for one submit button with formnovalidate.
Read & copyHTML Placeholder Attribute
Hint text shown inside an empty field; it is not a label and is never submitted.
Read & copyHTML maxlength & minlength
Limit how many characters a text input or textarea accepts, and require a minimum.
Read & copyHTML multiple attribute
Let a file input, select or email input take more than one value.
Read & copyHTML name attribute
The key each field is submitted under; a field without a name is never sent.
Read & copyHTML readonly & disabled
readonly locks a field but still submits it; disabled locks it and leaves it out.
Read & copyHTML Form target
Where the form's response opens: same tab, new tab, or a named iframe.
Read & copyHTML form attribute
Ties a control outside the <form> to it by id, so its value is still submitted.
Read & copyHTML value attribute
Sets a control's starting value and, for checkboxes, radios, options and buttons, what gets submitted.
Read & copyHTML Disabled Attribute
A boolean attribute that turns a form control off and leaves it out of the submission.
Read & copyHTML minlength attribute
Set the fewest characters a text input or textarea must have before the form can submit.
Read & copyHTML formaction attribute
Send one form to a different URL, method or validation mode depending on which submit button is clicked.
Read & copyHTML inputmode attribute
Choose which on-screen keyboard a phone shows for a field, without changing how the field validates.
Read & copyHTML min and max attributes
Set the lowest and highest allowed value for number, range, date, time, month and week inputs.
Read & copyHTML step attribute
Set which values a number, range, date or time input accepts, counted in steps from min.
Read & copyHTML accept Attribute
Tells a file input which file types to show in the picker, by MIME type or extension.
Read & copyHTML spellcheck Attribute
Turn browser spell check on or off for textareas, inputs, and editable content.
Read & copyHTML autofocus Attribute
Focus an input automatically when a page or dialog opens.
Read & copyHTML enterkeyhint Attribute
Set the label of the Enter key on mobile keyboards.
Read & copyHTML checked attribute
A boolean attribute that sets a checkbox or radio button's default checked state.
Read & copyHTML selected attribute
A boolean attribute on an option that makes it the default choice when the select loads.
Read & copyHTML size attribute
Sets the visible character width of a text input or the visible rows in a select listbox.
Read & copyHTML title attribute
Provides advisory text that browsers may show as a tooltip or pattern validation hint.
Read & copyHTML autocapitalize Attribute
Hint whether a mobile keyboard should auto-capitalize letters as the visitor types.
Read & copyLooking for a ready-made form? See the form templates or the free HTML drop-in.
Ship a working form in under a minute.
Grab a free access key, paste one endpoint into any element above, and start collecting submissions — 500 free to start, spam-filtered, no server code.