👀 Live Preview
Three fields with different autocapitalize values:
Test on a phone or tablet to see keyboard capitalization differences.

The autocapitalize attribute is a useful feature in HTML that allows developers to control the capitalization behavior of text inputs. This attribute is particularly beneficial for enhancing user experience by ensuring text inputs are automatically capitalized according to specified rules, which can be especially helpful for mobile and touchscreen devices.
No auto caps.
First letter each sentence.
Capitalize each word.
All uppercase.
Virtual keyboards.
Set dynamically.
autocapitalize AttributeThe primary purpose of the autocapitalize attribute is to manage how text entered into an input field is capitalized. This attribute can be applied to <input> and <textarea> elements, ensuring consistent text formatting hints for virtual keyboards without requiring additional user effort.
autocapitalize mainly affects iOS and Android virtual keyboards. It does not transform text after it is entered—it hints how the keyboard should behave.
Add autocapitalize to an <input> or <textarea> with a keyword value:
<input type="text" autocapitalize="words">input and textarea.none, sentences, words, or characters.type (e.g. type="email" with autocapitalize="none").The autocapitalize attribute accepts several values, each defining a different capitalization behavior:
<input autocapitalize="none">
<input autocapitalize="sentences">
<input autocapitalize="words">
<input autocapitalize="characters">| Field Type | Suggested Value | Why |
|---|---|---|
| Full name | words | Capitalize each name part |
| Bio / comment | sentences | Normal sentence case |
| Access code / SKU | characters | All caps entry |
| Email / username | none | Avoid unwanted caps |
| Applicable elements | input, textarea | Text entry fields |
| Element | Supported? | Notes |
|---|---|---|
<input type="text"> | Yes | Primary use case |
<textarea> | Yes | Multi-line text |
<input type="email"> | Yes | Often use none |
<select> | No practical effect | Not a text entry control |
Form with multiple values, dynamic JavaScript, and none for email fields.
Three fields with different autocapitalize values:
Test on a phone or tablet to see keyboard capitalization differences.
Here’s an example of how to use the autocapitalize attribute in an HTML form:
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" autocapitalize="words">
<label for="bio">Bio:</label>
<textarea id="bio" name="bio" autocapitalize="sentences"></textarea>
<label for="code">Access Code:</label>
<input type="text" id="code" name="code" autocapitalize="characters">
<input type="submit" value="Submit">
</form>In this example, the autocapitalize attribute is set to words for the name input field, sentences for the bio textarea, and characters for the access code input field.
You can also dynamically set the autocapitalize attribute using JavaScript. This can be useful when you want to change the capitalization behavior based on certain conditions or user interactions. Here’s a brief example:
<input type="text" id="dynamicField">
<script>
document.getElementById("dynamicField").setAttribute("autocapitalize", "words");
</script>In this script, the autocapitalize attribute is set to words for an input field with the id dynamicField. This can be helpful when dynamically changing input field properties based on the application’s logic.
Disable automatic capitalization for fields where caps would be wrong:
<input type="email" autocapitalize="none" placeholder="user@example.com">none tells the virtual keyboard not to auto-capitalize. This is ideal for email addresses, usernames, and URLs.
Choose none, sentences, words, or characters.
Virtual keyboard reads the capitalization hint.
Caps apply as the user types each character or word.
Users type names, sentences, and codes with less manual shifting.
The autocapitalize attribute is supported on mobile browsers (iOS Safari, Chrome for Android). Desktop browsers may ignore it because physical keyboards do not use the hint.
iOS and Android honor autocapitalize on text fields. Desktop support is limited.
Bottom line: Use autocapitalize for mobile-friendly forms; test on real devices.
words for names and titlessentences for bios and commentscharacters for codes and acronymsnone for email and username fieldscharacters on regular name fields<select> expecting text capsThe autocapitalize attribute is a powerful tool for managing text capitalization in HTML forms. By understanding and using this attribute appropriately, you can improve the usability and readability of your web forms, providing a better experience for your users.
Match each field’s value to the kind of text you expect, and always test on mobile where the effect matters most.
autocapitalizeBookmark these before building mobile forms.
none to characters.
ValuesVirtual keyboards.
PlatformText fields only.
ScopesetAttribute()
DynamicNot validation.
Behaviorinput and textarea elements used for text entry.none, sentences, words, and characters.element.setAttribute("autocapitalize", "words") at runtime.Practice the autocapitalize attribute with name, bio, and code fields in the Try It editor.
5 people found this page helpful