JOURNAL / PRODUCT DESIGN / FORMS

A number field is not always a number input

Card numbers, codes and postcodes are digits, not numbers. The HTML standard’s spinbox test, what GOV.UK found when it dropped the number input, and a three-way sort (quantity, amount, identifier) that settles which control each field needs.

· 6 MIN READ · Blanche Agency
Engraving-style drawing of an antique wooden abacus with rows of round beads pushed to either side.
Original illustration: an abacus is for numbers you count with, which is not every field made of digits. · Blanche Agency · aiBLANCHE / 2026

INTRODUCTION

A form asks for a card number, a quantity and a postcode. All three are made of digits, so all three get type="number". It feels tidy. It is also wrong for two of the three, and the mistake shows up in odd places: a reference that silently changes when someone scrolls, a voice-control user who cannot fill the field, a long number that turns into scientific notation.

The decision is small and it repeats on every form you ship. Here is a way to make it once.

The test the HTML standard gives you

The HTML specification is blunt about this. Its section on the number state says that type=number “is not appropriate for input that happens to only consist of numbers but isn't strictly speaking a number”, and names credit card numbers and postal codes as examples. Then it offers a test that fits on a sticky note: would it make sense for the control to have a spinbox, with up and down arrows?

The reasoning is the useful part. Getting a card number wrong by one in the last digit is not a small error; it is as wrong as getting every digit wrong. Nobody selects a card number by nudging it upwards. If “one more” means nothing, the field holds digits, not a number.

What goes wrong in practice

In February 2020 the GOV.UK Design System team explained why it stopped using the number input, even in its date component. The post is six years old and the browser versions it names are older still, so treat the details as history. The categories of failure are what last:

  • Assistive technology. The team found the field could not be dictated into with Dragon NaturallySpeaking, and that the NVDA screen reader announced it in confusing ways, including as an unlabelled spin button.
  • The browser treats it as arithmetic. Pressing the up or down arrow on a long value made Chrome display it in exponential format, and the user could not reverse it. Older Safari versions rounded values of sixteen digits or more.
  • Accidental changes. The current GOV.UK text input guidance adds the risk of people incrementing a number by accident when they meant to scroll the page, and notes that when someone types something that is not a number there is no explicit feedback about what went wrong.

Its conclusion is one line: do not use type="number" unless your user research shows there is a need for it.

What to use instead

The reason teams reached for the number input in the first place was the keypad on phones. That now has its own attribute, described on MDN: inputmode tells the device which on-screen keyboard to show, without changing what the field is:

  • inputmode="numeric" shows a keypad for the digits 0 to 9.
  • inputmode="decimal" adds the decimal separator for the user's locale.
  • inputmode="tel" shows a telephone keypad.

So the GOV.UK pattern for a whole number is a plain text input with inputmode="numeric", and for a number with decimals, inputmode="decimal". One detail is easy to miss: some devices leave the minus key off these keypads. If negative values are possible, the guidance is to use a text input with no inputmode at all.

Three kinds of “number”

Sorting fields into three groups settles most cases.

  • Quantities. How many tickets, guests, copies. Small, whole, and “one more” is exactly what people want. A number input, or a stepper with visible plus and minus buttons, is a fair choice here.
  • Amounts and measurements. Prices, weights, distances. They are real numbers, but people paste them, type currency symbols, and use a comma or a point depending on where they grew up. A text input with inputmode="decimal", and parsing that tolerates what people actually type, serves them better than a field that rejects the entry.
  • Identifiers. Card numbers, account numbers, verification codes, reference numbers, postcodes. Digits used as a name. Always a text input, with inputmode="numeric" when it really is digits only.

The same sorting helps with neighbouring decisions, such as how to ask for a date.

The case for the number input

It is not a useless element. It gives you min, max and step with built-in validation, a value the browser has already parsed, and a stepper for free. The specification allows browsers to accept local formats such as “3,99” as well as “3.99”, without requiring it, and its own example of a number input is a price. For an internal tool where staff adjust stock levels all day with a keyboard, those arrows are a feature.

The argument holds exactly as far as the spinbox test does. Where stepping makes sense, the number input earns its place. Where it does not, you are taking on its arithmetic behaviour to get a keypad you could have had with one attribute. And choosing a text input means the validation becomes your job: say what format you expect, accept reasonable variations, and explain errors in words.

A worked example

A hypothetical booking form has three numeric fields: number of guests, a booking reference such as 0048213, and a nightly budget.

  • Guests is a quantity. A number input with min="1" is fine; a stepper is friendlier on a phone.
  • The booking reference is an identifier. Add one to it and it becomes someone else's booking. Text input, inputmode="numeric", and spell-check off.
  • The budget is an amount. Text input, inputmode="decimal", the currency shown beside the field instead of inside it, and a parser that accepts “120”, “120.00” and “120,00”.

Three fields, three different answers, and none of them needed a debate.

Start with the identifiers

List every field in your product that expects digits and sort each one into quantity, amount or identifier. Change the identifiers first: they are the ones where a silent change does real damage, and the fix is a single line. Then try the form with a phone keypad and with a mouse wheel over the field. Like the question of what a name field should accept, this is less about HTML than about being honest about what you are asking for.

Sources checked on 29 November 2026. The GOV.UK blog post dates from 24 February 2020; the Design System guidance and the HTML specification are living documents.

KEEP THINKING

Keep reading.

More ideas on building better brands and digital products.

Product design

The focus ring is part of the design

Product design

Follow the system theme before you build a dark mode switch

View all articles