👀 Live Preview
Quantity field with min="1" and max="100":
Values below 1 fail browser constraint validation when the form is submitted or checkValidity() runs.

The min attribute sets the minimum allowed value on certain <input> types and defines the lower bound of the scale on <meter> and <progress> elements. It is essential for form validation—preventing zero or negative quantities, blocking dates before a cutoff, and anchoring range sliders. Pair it with max to define a valid range. Do not confuse min with minlength (minimum character count on text inputs) or low on <meter> (warning threshold, not the scale limit).
Floor user input.
Numeric min value.
Earliest pickable.
Valid range pair.
Value vs chars.
Update at runtime.
min AttributeThe primary purpose of min is to enforce a lower bound on values the user can submit. A quantity field with min="1" rejects zero or negative orders. A date field with min="2026-01-01" blocks dates before that day. A range slider with min="0" and max="100" maps its track to that numeric span.
Browsers use min during constraint validation. Values strictly below min make the control invalid; the form may not submit until the value is corrected (unless JavaScript bypasses checks). This is client-side guidance only—always re-validate on the server.
A value of 1 with min="1" is valid. The old reference incorrectly said input must “exceed” the minimum—the rule is value ≥ min, not strictly greater than.
Add min with a value matching the input type’s format:
<label for="quantity">Quantity:</label>
<input type="number" id="quantity" name="quantity" min="1" max="100" value="1">
<label for="startDate">Start date:</label>
<input type="date" id="startDate" min="2026-01-01">
<label for="volume">Volume:</label>
<input type="range" id="volume" min="0" max="100" value="50">
<meter min="0" max="100" value="72"></meter>YYYY-MM-DD; time uses HH:MM.number, range, date, time, datetime-local, month, week, meter, and progress.minlength for character minimums.max; ensure min ≤ max.inputElement.min = "5" (string).step on number and range inputs for increment alignment.The min attribute accepts a string whose meaning depends on the control type:
min="1" on type="number" — Lowest allowed integer (e.g. quantity at least 1).min="0" on type="range" — Left end of the slider track.min="2026-01-01" on type="date" — Earliest selectable date.min="09:00" on type="time" — Earliest selectable time.min="0" on <meter> or <progress> — Lower bound of the scale (not the current value).document.getElementById("dynamicMinField").min = "5";
document.getElementById("startDate").setAttribute("min", "2026-06-01");| Use case | Markup | Notes |
|---|---|---|
| Minimum quantity | <input type="number" min="1"> | No zero orders |
| Slider floor | <input type="range" min="0" max="100"> | Track bounds |
| Earliest date | <input type="date" min="2026-01-01"> | ISO date string |
| Valid range | min="1" max="100" | Pair both attributes |
| Text minimum | Use minlength, not min | Character count |
| JS update | el.min = "10" | String property |
| Element / type | Supported? | Notes |
|---|---|---|
<input type="number"> | Yes | Most common use |
<input type="range"> | Yes | Slider lower bound |
date, time, datetime-local, month, week | Yes | Type-specific date/time strings |
<meter>, <progress> | Yes | Scale lower bound |
text, email, textarea | No | Use minlength instead |
min vs max vs minlength| Attribute | Applies to | Limits |
|---|---|---|
min | number, range, date/time inputs; meter, progress | Minimum numeric or date/time value |
max | Same input types; meter, progress | Maximum numeric or date/time value |
minlength | text, search, url, tel, email, password, textarea | Minimum character count (validation) |
Number input floor, earliest date, and dynamic min on a range slider with JavaScript.
Quantity field with min="1" and max="100":
Values below 1 fail browser constraint validation when the form is submitted or checkValidity() runs.
Ensure at least one item with min="1" on a quantity field:
<label for="quantity">Quantity:</label>
<input
type="number"
id="quantity"
name="quantity"
min="1"
max="100"
value="1">The browser compares the current value to min during constraint validation. Invalid values block form submission unless JavaScript bypasses checks—validate on the server too.
Block dates before a booking window opens:
<label for="startDate">Start date:</label>
<input type="date" id="startDate" min="2026-01-01">Date inputs interpret min as an ISO date string. Combine with max to define an allowed booking window.
Adjust the minimum at runtime when rules change:
<input type="range" id="volume" min="0" max="100" value="50">
<script>
document.getElementById("volume").min = "25";
</script>Assigning a string to input.min updates the lower bound immediately. If the current value is below the new min, bump it up or mark the field invalid. Re-validate after dynamic changes.
<label for="id"> so users know what the min limit applies to.aria-invalid when you enhance validation with JavaScript.min, consider an aria-live region explaining the new floor.min alone can be bypassed; enforce limits on the server.Lower bound in markup.
Type, pick, or slide.
Value ≥ min required.
Data within range.
The min attribute on supported input types and on <meter> and <progress> is fully supported in all modern browsers. Constraint validation behavior is consistent across Chrome, Firefox, Safari, and Edge.
All major browsers enforce min on number, range, and date/time inputs.
Bottom line: Safe to use on supported elements; validate minimums on the server too.
min with max for a clear valid rangemin="1" on quantity fields that cannot be zeromin in JavaScriptmin with minlength on text fieldsmin greater than maxThe min attribute is a practical way to set lower bounds on numeric, date, and time form values. Applied to the right input types and paired with max, it guides users toward valid data and catches out-of-range input before submission.
Remember that valid means greater than or equal to min, distinguish min from minlength, and always enforce limits on the server. Update input.min in JavaScript when business rules change at runtime.
minBookmark these before building numeric forms.
Not char count.
MeaningSupported types.
ScopeEqual is valid.
RuleDefine full range.
CompareClient ≠ secure.
Securitymin limits numeric or date/time values. minlength limits the minimum number of characters in text fields and textarea.min is valid. The value must be greater than or equal to min, not strictly greater.inputElement.min = "5" or setAttribute("min", "5") on HTMLInputElement.min="1" max="100". Ensure min is less than or equal to max.Practice number floors, earliest dates, and dynamic input.min in the Try It editor.
5 people found this page helpful