autocapitalize
Controls automatic capitalization on mobile virtual keyboards. Pair with inputmode for complete mobile keyboard control.
Overview
The autocapitalize attribute controls whether and how the virtual keyboard automatically capitalizes text as the user types. It affects only mobile and tablet virtual keyboards — physical keyboards and desktop browsers are unaffected.
Applies to: <input> (text types), <textarea>, and any element with contenteditable
Values
| Value | Behavior | Use Case |
|---|---|---|
none / off | No automatic capitalization | Usernames, email addresses, URLs, codes |
sentences | Capitalize the first letter of each sentence (the default) | General prose, comments, descriptions |
words | Capitalize the first letter of each word | Name fields, titles, headings |
characters | All characters uppercase | License plates, booking references, country codes |
Practical Examples
All-Caps Input
Use characters for fields where the value is always uppercase. The keyboard shifts to caps lock mode so the user does not need to toggle it manually.
Registration Form
A complete form demonstrating appropriate autocapitalize values for different field types.
Contenteditable
The attribute also works on contenteditable elements, providing the same keyboard behavior outside of form fields.
Pairing with inputmode
For complete mobile keyboard control, combine autocapitalize with inputmode. Together they determine both the keyboard layout and the capitalization behavior:
inputmode="text" autocapitalize="words"— text keyboard with title-case capitalization for name fieldsinputmode="text" autocapitalize="none"— text keyboard with no auto-caps for usernamesinputmode="url"— URL keyboard (autocapitalize has no effect since URLs are case-insensitive in practice)
Automatic Handling
Some input types ignore autocapitalize because the browser already knows the correct behavior:
type="email"— no capitalization (email addresses are lowercase)type="url"— no capitalizationtype="password"— no capitalization
For these types, setting autocapitalize has no effect. The browser does the right thing automatically.
Accessibility
- No impact on assistive technology. The
autocapitalizeattribute does not change how screen readers announce the field or its content. - Reduces input friction. Correct capitalization settings prevent mobile users from needing to manually toggle Shift, which is especially helpful for users with motor impairments.
- Pair with
autocomplete. Fields like names benefit from bothautocapitalize="words"andautocomplete="name"— the former helps manual entry while the latter enables autofill.
Limitations
- Desktop has no effect: Physical keyboards and desktop browsers ignore this attribute entirely. It is purely a mobile optimization.
- Keyboard-app dependent: Virtual keyboard apps may interpret values differently. Most major keyboards (iOS, Gboard, Samsung Keyboard) support all four values, but third-party keyboards may not.
- Suggestion only: The attribute is a hint, not a constraint. Users can still manually change capitalization. It does not validate or transform the submitted value.
- No mid-word control: You cannot capitalize specific characters within a word (e.g., camelCase). The attribute operates at the sentence, word, or character level only.
See Also
inputmode— control which virtual keyboard layout appearsenterkeyhint— control the Enter key label on virtual keyboardsautocorrect— control automatic text correction on mobilespellcheck— enable or disable browser spell-checkingautocomplete— browser autofill hints