About This HTML Issue
Remove the empty maxlength value and provide a non-negative integer or omit the attribute entirely.
Explanation
The maxlength attribute on an input element must be a valid non-negative integer per the HTML specification. An empty string ("") is invalid and triggers the validator error.
-
Valid: a decimal integer like
0,10,255. -
Invalid: empty string, negative numbers, non-numeric strings, or whitespace.
If no maximum length is needed, omitmaxlengthinstead of leaving it empty.
Note thatmaxlengthapplies to text-entry controls such astype="text",search,url,tel,email, andpassword. For other types (e.g.,number,date),maxlengthis ignored and should not be used.
Examples
Correct: set an explicit maximum
<input type="text" name="username" maxlength="20">
Correct: no maximum, omit the attribute
<input type="text" name="comment">
Incorrect: empty string (validator error)
<input type="text" name="username" maxlength="">
Last reviewed: August 11, 2025
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.