HTML min Attribute
The HTML min attribute defines the minimum permitted value for certain input controls and establishes the lower bound of the range represented by a <meter> element.
Elements That Use the min Attribute
The min attribute is used with several types of <input> controls and with the <meter> element.
| Element | Description |
|---|---|
<input type="date"> |
Sets the earliest permitted date. |
<input type="month"> |
Sets the earliest permitted month and year. |
<input type="week"> |
Sets the earliest permitted week and year. |
<input type="time"> |
Sets the minimum permitted time. |
<input type="datetime-local"> |
Sets the earliest permitted local date and time. |
<input type="number"> |
Sets the minimum permitted numeric value. |
<input type="range"> |
Sets the lower bound of the range control. |
<meter> |
Defines the lower numeric bound of the measured range. |
Using min with <input>
On a supported <input> element, the min attribute establishes the smallest value the control accepts. The required format depends on the input type.
<label for="quantity">Quantity (1–10):</label>
<input type="number" id="quantity" name="quantity" min="1" max="10">
In this example, values below 1 are less than the minimum permitted value.
min Values for <input>
The format of the min value depends on the input type.
| Input Type | Example |
|---|---|
date |
min="2026-01-01" |
month |
min="2026-01" |
week |
min="2026-W01" |
time |
min="08:00" |
datetime-local |
min="2026-01-01T08:00" |
number |
min="1" |
range |
min="0" |
Using min with <meter>
On a <meter> element, the min attribute defines the lower numeric bound of the measured range. If min is omitted, the default minimum is 0.
<meter min="0" max="100" value="75">75%</meter>
The minimum must not be greater than the maximum. The meter's value, low, high, and optimum values are interpreted within the range established by min and max.
min and max
The min and max attributes can be used together to define the permitted range for supported input controls and the overall range of a <meter> element.
<input type="number" min="1" max="10">
In this example, the permitted numeric range extends from 1 through 10. The min value should not be greater than the max value.
min and step
For input types that support step, the min value can establish the starting point used to determine which stepped values are valid.
<input type="number" min="1" max="10" step="2">
With min="1" and step="2", valid stepped values include 1, 3, 5, 7, and 9.
Constraint Validation
For input types that support constraint validation, a user-entered value below the minimum can cause the control to fail validation. An out-of-range control can match the CSS :invalid and :out-of-range pseudo-classes.
<input type="number" min="1" max="10" value="0">
In this example, 0 is below the minimum of 1, so the control is outside its permitted range.
Common Mistakes
Do not use the same value format for every input type. Numeric controls require numbers, while date and time controls require values in the format expected by that input type.
Do not confuse min with minlength. The min attribute limits a numeric, date, or time value, while minlength specifies the minimum number of characters required in supported text controls.
Do not set min greater than max. The minimum and maximum values should define a valid range.
Do not rely only on client-side range validation when submitted data must meet minimum requirements. Validate important submitted values on the server as well.
Browser Support
Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.
The min attribute is widely supported on applicable input types and on the <meter> element. Compatibility for individual input types can differ because the controls themselves have different browser support histories.
Checking Browser Support
For current browser compatibility information, visit Can I Use? . Search for the HTML element or attribute you want to check. You can also narrow your search by entering an element name and attribute name separated by a colon. Search results can include related HTML features, element attributes, input types, APIs, and other technologies, so select the result that most closely matches the feature you are checking.
Try the min Attribute
The example uses min="1" and max="10" to define the permitted range for a number input. Use the number controls to see how the min attribute establishes the lowest permitted value.
Summary
The HTML min attribute establishes a minimum value for supported <input> controls and defines the lower bound of a <meter> element. Its required value and behavior depend on the element or input type where it is used.
