GO-V.ORG
As seen in

`min` HTML attribute

The min attribute defines the minimum value that is acceptable and valid for the input containing the attribute. If the value of the element is less than this, the element fails validation. This value must be less than or equal to the value of the max attribute.

The **`min`** attribute defines the minimum value that is acceptable and valid for the input containing the attribute. If the [`value`](/docs/Web/HTML/Reference/Elements/input#value) of the element is less than this, the element fails [validation](/docs/Learn_web_development/Extensions/Forms/Form_validation). This value must be less than or equal to the value of the `max` attribute.

Some input types have a default minimum. If the input has no default minimum and a value is specified for `min` that can't be converted to a valid number (or no minimum value is set), the input has no minimum value.

It is valid for the input types including: date, month, week, time, datetime-local, number and range types, and the meter element.

## Syntax

<table class="no-markdown">
<caption>
Syntax for
<code>min</code>
values by input
<code>type</code>
</caption>
<thead>
<tr>
<th>Input type</th>
<th>Syntax</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>date</td>
<td><code>yyyy-mm-dd</code></td>
<td><code>&#x3C;input type="date" min="2019-12-25" step="1"></code></td>
</tr>
<tr>
<td>month</td>
<td><code>yyyy-mm</code></td>
<td><code>&#x3C;input type="month" min="2019-12" step="12"></code></td>
</tr>
<tr>
<td>week</td>
<td><code>yyyy-W##</code></td>
<td><code>&#x3C;input type="week" min="2019-W23" step=""></code></td>
</tr>
<tr>
<td>time</td>
<td><code>HH:mm</code></td>
<td><code>&#x3C;input type="time" min="09:00" step="900"></code></td>
</tr>
<tr>
<td>
datetime-local
</td>
<td><code>yyyy-mm-ddTHH:mm</code></td>
<td>
<code>&#x3C;input type="datetime-local" min="2019-12-25T19:30"></code>
</td>
</tr>
<tr>
<td>number</td>
<td><a href="/en-US/docs/Web/CSS/Reference/Values/number">&#x3C;number></a></td>
<td>
<code>&#x3C;input type="number" min="0" step="5" max="100"></code>
</td>
</tr>
<tr>
<td>range</td>
<td><a href="/en-US/docs/Web/CSS/Reference/Values/number">&#x3C;number></a></td>
<td>
<code>&#x3C;input type="range" min="60" step="5" max="100"></code>
</td>
</tr>
</tbody>
</table>

> [!NOTE]
> When the data entered by the user doesn't adhere to the min value set, the value is considered invalid in constraint validation and will match the :invalid and :out-of-range pseudo-classes.

See [Client-side validation](/docs/Web/HTML/Guides/Constraint_validation) and rangeUnderflow for more information.

For the meter element, the `min` attribute defines the lower numeric bound of the measured range. This must be less than the maximum value ([`max`](/docs/Web/HTML/Reference/Attributes/max) attribute), if specified. In both cases, if omitted, the value defaults to 1.

<table class="no-markdown">
<caption>
Syntax for
<code>min</code>
values for other elements
</caption>
<thead>
<tr>
<th>Input type</th>
<th>Syntax</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>meter</td>
<td><a href="/en-US/docs/Web/CSS/Reference/Values/number">&#x3C;number></a></td>
<td>
<code
>&#x3C;meter id="fuel" min="0" max="100" low="33" high="66"
optimum="80" value="40"> at 40/100&#x3C;/meter></code
>
</td>
</tr>
</tbody>
</table>

### Impact on step

The value of `min` and `step` define what are valid values, even if the `step` attribute is not included, as `step` defaults to `0`.

We add a big red border around invalid inputs:

```css
input:invalid {
border: solid red 3px;
}
```

Then define an input with a minimum value of 7.2, omitting the step attribute, wherein it defaults to 1.

```html
<input id="myNumber" name="myNumber" type="number" min="7.2" value="8" />
```

Because `step` defaults to 1, valid values include `7.2`, `8.2`, `9.2`, and so on. The value 8 is not valid. As we included an invalid value, supporting browsers will show the value as invalid.

200

If not explicitly included, `step` defaults to 1 for `number` and `range`, and 1 unit type (second, week, month, day) for the date/time input types.

## Accessibility concerns

Provide instructions to help users understand how to complete the form and use individual form controls. Indicate any required and optional input, data formats, and other relevant information. When using the `min` attribute, ensure this minimum requirement is understood by the user. Providing instructions within the label may be sufficient. If providing instructions outside of labels, which allows more flexible positioning and design, consider using [`aria-labelledby`](/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-labelledby) or [`aria-describedby`](/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-describedby).

## Specifications

## Browser compatibility

## See also

- [`step`](/docs/Web/HTML/Reference/Attributes/step)
- [`max`](/docs/Web/HTML/Reference/Attributes/max)
- other meter attributes: [`low`](/docs/Web/HTML/Reference/Elements/meter#low), [`high`](/docs/Web/HTML/Reference/Elements/meter#high), [`optimum`](/docs/Web/HTML/Reference/Elements/meter#optimum)
- [Constraint validation](/docs/Web/HTML/Guides/Constraint_validation)
- [Form validation](/docs/Learn_web_development/Extensions/Forms/Form_validation)
- validityState.rangeUnderflow
- :out-of-range
- input
- date, month, week, time, datetime-local, number and range types, and the meter

source: MDN Web Docs mirror · page

Cite this

"`min` HTML attribute". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/min

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·