HTML reference
input step
The step attribute sets the interval between allowed values for supported number, date, and time inputs.
What you will learn
- What interval
stepdescribes - How it works with
minandmax - What browser validation does and does not guarantee
Number example
<label for="price">Price</label>
<input id="price" name="price" type="number" min="0" max="100" step="0.5">This allows values from 0 to 100 in increments of 0.5, such as 10.5. The allowed sequence can depend on the starting point defined by min.
Date and time examples
<input type="date" step="7">
<input type="time" step="900">A date step of 7 can represent weekly intervals, while a time step of 900 represents 15 minutes. Always test the values and format your users need.
Validation
A value that does not match the step can fail browser constraint validation. This is a helpful user experience, not a security boundary. Parse and validate the value again on the server.