HTML

HTML Input Types: Text, Email, Checkbox, Radio, and More

The HTML <input> tag has many types. Learn text, email, checkbox, radio and more, and how the right type makes forms easier to use on mobile.

RazakTerra
Reading time
2 min read
Comments
Discussion
HTML Input Types: Text, Email, Checkbox, Radio, and More
On this page
  1. Common Input Types
  2. Text : for general short text
  3. Email : optimized for email addresses
  4. Password : hides the characters as you type
  5. Number : only allows numbers
  6. Date : shows a date picker in most browsers
  7. Checkbox : for multiple choices
  8. Radio : for selecting only one option
  9. Other Useful Input Types
  10. Quick Tips

Common Input Types

Text : for general short text

Playground
<input type="text" name="fullname" placeholder="Your name" />
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Email : optimized for email addresses

Playground
<input type="email" name="email" placeholder="you@example.com" />
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Password : hides the characters as you type

Playground
<input type="password" name="password" />
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Number : only allows numbers

Playground
<input type="number" name="age" min="1" max="100" />
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Date : shows a date picker in most browsers

Playground
<input type="date" name="birthday" />
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Checkbox : for multiple choices

Playground
<input type="checkbox" id="html" name="skill" value="html" />
<label for="html">HTML</label>

<input type="checkbox" id="css" name="skill" value="css" />
<label for="css">CSS</label>
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Radio : for selecting only one option

Playground
<input type="radio" id="male" name="gender" value="male" />
<label for="male">Male</label>

<input type="radio" id="female" name="gender" value="female" />
<label for="female">Female</label>
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

Other Useful Input Types

Playground
<input type="tel" name="phone" />
<!-- Phone number -->
<input type="url" name="website" />
<!-- Website URL -->
<input type="file" name="upload" />
<!-- File upload -->
<input type="color" name="favcolor" />
<!-- Color picker -->
<input type="range" name="volume" min="0" max="100" />
<!-- Slider -->
Result
Cmd/Ctrl + Enter runs it · Esc leaves the editor

When to Use Each Type

Type Best Used For
text Names, titles, general short text
email Email addresses
password Passwords
number Age, quantity, ratings
date Birthdays, appointments
checkbox Multiple options (select many)
radio Single option (select only one)
file Uploading images or documents
tel Phone numbers
url Website links

Quick Tips

  • Use the correct input type whenever possible, mobile devices will show the matching keyboard.
  • Always pair inputs with a <label> for better accessibility.
  • Radio buttons that belong together must share the same name.
  • placeholder is just a short hint, not a replacement for a proper label.

Written by

Razak

Writes about the web, slowly, and builds small tools on the side.

Discussion

Comments

Loading comments…

Keep reading