HTML autocapitalize Attribute

Last Updated : 23 Jul, 2025

The HTML autocapitalize attribute is used to define whether the text present inside the HTML element should be automatically capitalized or not. It is a global attribute which means it is applied to all HTML elements.

Features:

  • It specifies how the text will be automatically capitalized.
  • It indicates that the first letter of the word or sentence would be in Capital.
  • It does not support <input> tag with type URL, Email, and Password.
  • It is a Global Attribute.

Syntax:

<tag_name autocapitalize="off | none | on 
| sentences | words | characters" />

Attribute Values:

  • off/none: It defines that the text will not be capitalized.
  • on/sentences: It defines that the first letter of each sentence would be capital.
  • words: It defines that the first letter of each word would be capital.
  • characters: It specifies that the whole text will be capitalized.

Example: Below HTML code use the auto-capitalize attribute with the <input> Tag.  

HTML
<!DOCTYPE html>
<html>

<head>
    <title> HTML input autocapitalize Attribute
    </title>
</head>

<body style="text-align:center">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>

    <h2>
        HTML autocapitalize Attribute
        with &lt;input&gt; Tag
    </h2>

    Name:
    <input type="text" 
           autocapitalize="words" autofocus>
    <br><br>

    <!-- Assign id to the Button. -->
    <button id="GFG">
        Submit
    </button>
    <br>
</body>

</html>

Output:

Important Note: This code is working on virtual keyboards such as on mobile devices and voice inputs. It is not working on physical keyboards.

Supported Browsers:

Comment