Tutorials References Exercises Videos Menu
Free Website Get Certified Pro

HTML <input> minlength Attribute

❮ HTML <input> tag

Example

An <input> element with a minimum length of 8 characters:

<form action="/action_page.php">
  <label for="password">Password:</label>
  <input type="password" id="password" name="password" minlength="8"><br><br>
  <input type="submit" value="Submit">
</form>
Try it Yourself »

Definition and Usage

The minlength attribute specifies the minimum number of characters required in an input field.

Note: The minlength attribute can be used with input type: text, search, url, tel, email, and password.


Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Attribute
minlength 40.0 17.0 51.0 10.1 27.0

Syntax

<input minlength="number">

Attribute Values

Value Description
number The minimum number of characters required in an <input> element

❮ HTML <input> tag