The max attribute sets the highest allowed value for numeric and date-like <input> types. If the control’s value is greater than max, constraint validation fails.
It also defines the upper bound on <meter> and <progress>. Pair it with min (and often step). It is not the same as maxlength, which limits characters.
Baseline · Widely available.
Not deprecated and not experimental. Stable across modern browsers for supported input types, meter, and progress.
Client hint — still validate on the server.
Users can bypass browser checks. Always enforce the same upper limit in your backend.
Syntax
HTML Syntax
syntax.html
<input max="value">
Also: <meter max="…"> and <progress max="…">. The format of value depends on the control (number, date string, and so on). Keep max ≥ min.
max = 100. Full task size (must be greater than zero).
value = 40. Current progress toward that total.
Default. If max is omitted on progress or meter, it defaults to 1.
Fallback text.40% inside the tag helps when the bar UI is unavailable.
Edge Cases & Pitfalls
Most mistakes come from mixing up max with maxlength or using the wrong value format.
not maxlength
max ≠ maxlength
max caps a value. maxlength caps typed characters on text controls.
order
Keep max ≥ min
If max is less than min, or the attribute is invalid, the maximum is not applied as intended.
format
Match the input type
Dates need yyyy-mm-dd; times need HH:mm; numbers need a numeric string. Wrong formats are ignored.
meter
max is not high
On <meter>, max ends the whole scale. high only starts the upper zone inside that scale.
server
Re-check on the server
Client-side max can be bypassed. Enforce the same limit when you process the form.
Compatibility
Browser Support
max is an HTML attribute for inputs, meter, and progress in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
max
Widely supported on number, range, and date-like inputs, plus meter and progress. Chrome, Firefox, Safari, Edge, and Opera support constraint validation with max.
96%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet ExplorerPartial*
Partial*
maxWidely supported
Bottom line: *Safe on modern browsers. Always validate max again on the server.
Remember
Key Takeaways
Role: highest allowed value (inputs) or end of scale (meter/progress).
Order: keep max ≥ min; use the format that matches the control type.
Not maxlength: characters vs numeric/date value — different jobs.
Validation: over-max → rangeOverflow; still check on the server.
One line:max is the ceiling for the value — tell users the limit and enforce it server-side too.
Frequently Asked Questions
It sets the highest allowed value for number, range, and date-like inputs, and the upper bound for meter and progress. On inputs, a value above max fails constraint validation (rangeOverflow).
input types number, range, date, month, week, time, and datetime-local, plus the meter and progress elements.
max limits a numeric or date value. maxlength limits how many characters you can type in text fields and textarea.
Yes. The max value must be greater than or equal to min. If max is missing or invalid, no maximum is applied for that control.
The control is invalid. validity.rangeOverflow is true, and the field matches :invalid and :out-of-range. The browser can block form submit until it is fixed.
If max is omitted on meter or progress, the default is 1.