HTML Input Types: All 22+ Input Type Values
Explore every HTML input type from text, email, and password to date, color, range, and file. Understand when to use each type for optimal UX and built-in validation.
Forms
Detailed Explanation
HTML Input Types
The <input> element is the most versatile form control in HTML. The type attribute determines its appearance, behavior, and validation rules. HTML5 introduced many new input types beyond the classic text, password, and checkbox.
Text Input Types
| Type | Purpose | Mobile Keyboard |
|---|---|---|
text |
General text input | Standard |
email |
Email addresses | Email layout (@ key) |
password |
Hidden text input | Standard |
search |
Search queries | Search layout |
url |
Web addresses | URL layout (/ key) |
tel |
Phone numbers | Telephone layout |
Numeric Types
| Type | Purpose | Features |
|---|---|---|
number |
Numeric values | Spinner, min/max/step |
range |
Slider control | min/max/step |
Date and Time Types
| Type | Purpose |
|---|---|
date |
Calendar date picker |
time |
Time picker |
datetime-local |
Date and time (no timezone) |
month |
Year and month |
week |
Year and week number |
Selection Types
| Type | Purpose |
|---|---|
checkbox |
Multiple selection (boolean) |
radio |
Single selection from group |
Other Types
| Type | Purpose |
|---|---|
file |
File upload |
color |
Color picker |
hidden |
Hidden data field |
image |
Graphical submit button |
submit |
Form submission button |
reset |
Form reset button |
button |
Generic button |
Validation Attributes
Input types provide built-in validation:
<input type="email" required> <!-- Must be valid email -->
<input type="text" pattern="[A-Z]{3}"> <!-- Must match pattern -->
<input type="number" min="1" max="100"> <!-- Range validation -->
<input type="text" minlength="3" maxlength="50"> <!-- Length limits -->
Use Case
Choosing the right input type improves user experience by showing optimized mobile keyboards, providing built-in validation, and enabling native date/color pickers. This reduces the need for JavaScript validation libraries and third-party UI components.