Key facts
How does a number input behave?
A number input only accepts a valid number, checks it against min, max and step, and sends it as a string. The default step is 1, so decimals fail unless you change it.
| Fact | Detail |
|---|---|
| Mobile keyboard | A numeric keyboard. Add inputmode="decimal" to make sure a decimal point key shows. |
| Built-in validation | badInput when the text isn't a number, rangeUnderflow below min, rangeOverflow above max, and stepMismatch when the value doesn't fit step. |
| Submitted value | A number string such as 2.5. It is empty when the field is left blank. |
Default step | The default step is 1, so 2.5 fails. Use step="0.01" for money or step="any" for any decimal. |
| Scroll wheel and arrow keys | The up and down arrow keys, the spinner and, in some browsers, the scroll wheel change the value by one step. |
maxlength | Ignored on number inputs. Use max to limit the value. |
Sources: WHATWG HTML Standard: Number state (type=number) · MDN: <input type="number">




