HTML | input maxlength Attribute
The <input> maxlength attribute is used to specify the maximum number of characters enters into the <input> element.
Syntax:
<input maxlength="number">
Attribute Value:
- number: It contains single value number which allows the maximum number of character in <input> element. Its default value is 524288.
Example:
<!DOCTYPE html><html> <head> <title> HTML input maxlength Attribute </title></head> <body> <center> <h1 style="color:green;"> GeeksforGeeks </h1> <h2> HTML <input> maxlength Attribute </h2> <form action="#"> Username: <input type="text" name="usrname" maxlength="12"> <br> <br> Password: <input type="text" name="password" maxlength="10"> <br> <br> <input type="submit" value="Submit"> </form> </center></body> </html> |
Output:
Supported Browsers: The browsers supported by input maxlength Attribute are listed below:
- Google Chrome 1.0
- Internet Explorer 2.0
- Firefox 1.0
- Safari 1.0
- Opera 1.0


