HTML <input type="number">

Last Updated : 25 May, 2026

The HTML <input type="number"> element is used to create a numeric input field in a form. It allows users to enter only numerical values.

  • Used to accept numeric input from users.
  • Created using <input type="number"> inside a form.
  • Supports attributes like min, max, step, value, and required.

Syntax:

<input type="number">

Example: In this example, we will demonstrate the use of HTML <input type="number"> element.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML input Type Number
    </title>
</head>

<body style="text-align:center;">

    <h2>HTML &lt;input type="number"&gt;</h2>

    <form action="#">
        <label for="number">Enter Number:</label>
        <input type="number" id="number" 
            value="10" step="5">
    </form>
</body>

</html>
Comment