HTML: input type="number"

The number input is useful for numeric values and can describe a range and increment with min, max, and step.

What you will learn

Minimal example

<label for="guests">Guests</label>
<input id="guests" name="guests" type="number"
       min="1" max="12" step="1" value="2" required>

The browser can offer number controls and report values outside the declared range. The server must still parse and validate the submitted value.

Common mistakes