splitforms.com

HTML · INPUT TYPE

HTML input type number: min, max, step and when not to use it

Last reviewed

An <input type="number"> is for real amounts and counts, like a quantity or a price. The browser blocks text that isn't a number and checks min, max and step before the form submits. Don't use it for phone numbers, ZIP codes or card numbers: those are digits, not numbers you do math with. Always check the value again on the server.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

number-input-example.html
<label for="quantity">Quantity</label>
<input type="number" id="quantity" name="quantity" min="1" max="10" step="1">

Copy-paste code

HTML Input Type Number code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

Get free access key
input-type-number.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" autocomplete="name" required>

  <label for="quantity">Quantity</label>
  <input type="number" id="quantity" name="quantity"
         min="1" max="10" step="1" required>

  <!-- step="0.01" allows cents; inputmode shows a decimal keypad -->
  <label for="budget">Budget (USD)</label>
  <input type="number" id="budget" name="budget"
         min="0" step="0.01" inputmode="decimal" placeholder="250.00">

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Send</button>
</form>

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.

How does a number input behave?
FactDetail
Mobile keyboardA numeric keyboard. Add inputmode="decimal" to make sure a decimal point key shows.
Built-in validationbadInput when the text isn't a number, rangeUnderflow below min, rangeOverflow above max, and stepMismatch when the value doesn't fit step.
Submitted valueA number string such as 2.5. It is empty when the field is left blank.
Default stepThe default step is 1, so 2.5 fails. Use step="0.01" for money or step="any" for any decimal.
Scroll wheel and arrow keysThe up and down arrow keys, the spinner and, in some browsers, the scroll wheel change the value by one step.
maxlengthIgnored on number inputs. Use max to limit the value.

Sources: WHATWG HTML Standard: Number state (type=number) · MDN: <input type="number">

Attributes · <input type="number">

Which HTML Input Type Number attributes matter?

These attributes decide how the <input type="number"> behaves and what actually gets emailed to your inbox when someone submits.

HTML Input Type Number attributes and what each one does
AttributeWhat it doesDocs
nameThe key the value is sent under, such as quantity. Without a name, the field is never sent.
minThe lowest value allowed. Lower values fail with rangeUnderflow.MDN
maxThe highest value allowed. Higher values fail with rangeOverflow.MDN
stepThe size of each step. The default is 1. Use 0.01 for cents or any for any decimal.MDN
requiredBlocks submit while the field is empty.MDN
inputmodeinputmode="decimal" asks phones for a keypad with a decimal point; numeric asks for digits only.
placeholderAn example value, like 250.00. It disappears on typing, so it is not a label.

Common mistakes

HTML Input Type Number not working? Here's why.

Most broken forms come down to a few small mistakes with the <input type="number">. Check these before you ship, then forward every submission to Slack or a webhook.

  1. Decimals fail with the default step

    The default step is 1, so a value like 2.5 fails with stepMismatch. Add step="0.01" for money or step="any" for any decimal.

  2. Don't use it for phone numbers, ZIP codes or card numbers

    A number input drops leading zeros, shows spinner arrows and may change the value when you scroll. Use [input type=tel](/html/input-type-tel) for phone numbers, and type="text" with inputmode="numeric" for ZIP codes, postal codes and card numbers.

  3. maxlength does nothing

    Browsers ignore maxlength on a number input. Use max to set the highest value allowed.

  4. The value is still a string on the server

    The form sends text like "2.5", and anyone can send any value without your form. Parse it as a number on the server and check min, max and step again.

Sources: WHATWG HTML Standard: <input type="number"> · MDN: <input type="number">

Copy-paste ready

The HTML Input Type Number example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html input type number form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <input type="number"> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Input Type Number to any page.

Copy the html input type number example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

Copy the code

Copy the HTML Input Type Number example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

Drop the form into any HTML page. Submissions arrive in your dashboard.

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See payment forms →Need time slots? Online booking →

Setup guides for the stacks you use

Questions

HTML Input Type Number questions, answered.

View all FAQs
How do I allow decimals in a number input?

Set the step attribute. The default step is 1, so only whole numbers pass. Use step="0.01" for money with cents, or step="any" to allow any decimal.

How do I set a min and max on a number input?

Add min and max attributes, for example min="1" max="10". The browser blocks submit when the value is below min or above max, and the spinner stays inside that range.

Why doesn't maxlength work on a number input?

The maxlength attribute only applies to text-like inputs, so browsers ignore it on type=number. Use max to limit the value instead, for example max="999" for up to three digits.

How do I hide the number input spinner arrows?

Use CSS. In Chrome, Edge and Safari, set -webkit-appearance: none and margin: 0 on the ::-webkit-inner-spin-button and ::-webkit-outer-spin-button pseudo-elements. In Firefox, set appearance: textfield on the input.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08 per month, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions per month
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ