The two price field mistakes are putting a currency symbol inside the input and leaving the step at its default of 1. A price input should take digits only, with the symbol shown outside the box, and a plain number field accepts only whole numbers, so a value with cents fails unless you set step to 0.01 or to any. The U.S. Web Design System says prefixes and suffixes should show the currency while the input holds digits only, and MDN confirms that the default step validates integers alone.
Everyday takeaways
- Keep price inputs to digits only, and show the currency in the design or the label.
- Use a prefix or suffix only when every reasonable answer fits it.
- Leave the step at its default only when whole numbers are the right answer.
- Set step="0.01" for amounts with cents, or step="any" when precision varies.
- Test a value with a decimal point in the field before launch, and confirm that it submits.
Digits only: the rule behind price fields
The first mistake is treating a price field like a text box that can hold a dollar sign. The U.S. Web Design System guidance on input prefixes and suffixes gives the rule plainly: use prefixes and suffixes when the input refers to a unit or currency amount, but the user's input must include digits only, not units or a currency symbol.
That sentence contains two halves that often get merged. The prefix or suffix is the visual cue, such as a dollar sign shown in front of the box or a unit shown after it. The value a person types is the digits alone. A signup form that asks for a monthly price should show the currency in the design and accept a plain number in the field. Typing a dollar sign before the number hands the form a string it must clean up before it can use the number, and every extra cleanup step is another place for an error.
Growth teams feel this most when they copy a price from a pricing page. People paste what they see, so the field may receive the price with a dollar sign, a comma or a unit word attached. The form either rejects the entry or stores a value it cannot compare with other plans. Keeping the input to digits means your validation, your billing hand-off and your reporting all receive the same kind of value.
There is a quick check you can run before launch. Type a dollar sign, a comma, a space and a unit label into the price field and watch what happens. If the field accepts those characters without explaining why they are wrong, the form is leaving the cleanup to the server, or to nobody.
The rule also means the symbol should live somewhere else on the page. A label such as "Monthly price (USD)" beside the box tells the user the unit without asking them to type it, and an annual field takes a matching label such as "Annual price (USD)" so both fields state the unit the same way. Keep the currency in the design, and keep the characters the user types to the digits the system needs.
Why a $ prefix misleads on open-ended fields
A prefix is a promise about what goes in the box. The same guidance gives a clear case where that promise breaks: don't use a $ prefix for a form field asking "What's a fair resolution?" if the user could enter either "$1,000" or "a full refund" as the answer.
The example works because the question sounds like it wants money. A person reads the question, sees the dollar sign, and then wants to say they would accept a full refund. The design has told them what kind of answer is expected, and their honest answer does not fit the box. So they either write a number they do not mean or give up. Both outcomes hurt the data you collect.
Signup forms fall into the same trap. A field labeled "Budget" with a dollar prefix invites a figure, but a prospect may want to say "not sure yet" or "depends on team size." If the field must hold a number, give those answers a separate, clearly labeled choice rather than a dollar sign that pushes everyone toward a number.
Notice what the example does not say. It does not claim that dollar amounts are wrong in forms. It says the prefix should match what the field can accept. When a question can be answered in words, a currency symbol narrows the answer before the user has finished reading. On this reading, a neutral label, such as "Your fair price," with a free-text field serves the range of real answers better than a prefix does.
Growth leads often add a prefix to make a form look finished. Before you do, ask whether every answer a reasonable person might give can fit that prefix. If the answer is no, the prefix makes the form less accurate, not more polished.
Symbols, suffixes and digits side by side
The guidance explains the purpose of these visual cues in one line: use input prefixes and suffixes to show symbols or abbreviations that help users enter the right type of information in a form's text input. The purpose of the cue is to guide the user, and the input still receives plain characters.
The table below sets three common field types side by side. Each row uses the same three questions: where the symbol goes, what the user types, and which part of the guidance it follows.
| Field type | Where the symbol goes | What the user types | Basis in the guidance |
|---|---|---|---|
| Price in dollars | $ as a visible prefix | Digits only, with no $ sign | Prefix for a currency amount, digits only |
| Length or measure | Unit as a visible suffix | Digits only, with no unit | Suffix for a unit, digits only |
| Open-ended answer | No prefix or suffix | Free text, such as "$1,000" or "a full refund" | No $ prefix on an open-ended question |
Read the table by row, not by column. The symbol or unit is part of the design in the first two rows, and the input is the digits. The third row is the one where a prefix can shape the answer.
Abbreviations follow the same logic. A short label after a numeric box, such as a unit abbreviation, helps the user enter the right kind of value. The check is the same in every row: if the visible cue would lead someone to type something the field cannot accept, remove the cue or move it into the label.
Whole numbers by default: why cents fail
The step attribute decides which numbers a number field will accept, and its default is strict. MDN states that by default, the number input type only validates if the number is an integer, as the step attribute defaults to 1. The same page says that if the step is omitted, only whole numbers are valid.
The table shows how the default treats two typed values.
| Typed value | Step omitted (default 1) | Reason |
|---|---|---|
| 1 | Valid | A whole number matches the default step |
| 0.01 | Not valid | A fraction fails the integer rule |
The default is not a bug. The result is familiar: a customer types an amount with cents, the browser blocks submission, and the message may not explain that the field expects whole numbers.
The practical lesson is that the step is part of validation, not just a styling choice. When you review a price field, check the step value in the markup as well as the label. A field that looks right can still refuse the cents your pricing needs.
Allowing decimals with step="any" or "0.01"
When cents must be accepted, you have to say so in the markup. MDN's guidance is that to allow float numbers, you specify step="any" or a specific value, like step="0.01" to restrict the floating point. Both settings allow decimals, but they do different jobs.
The table compares the three settings row by row on the same measures.
| Setting | Decimals allowed | Precision rule | Best fit |
|---|---|---|---|
| step="any" | Yes | No fixed step is set by the attribute | Values where precision varies |
| step="0.01" | Yes, in 0.01 steps | Values restricted to the 0.01 grid | Amounts in dollars and cents |
| Step omitted | No, whole numbers only | Step of 1 | Counts of whole units |
The difference between "any" and "0.01" is the precision rule. Choosing step="any" removes the restriction, so the browser does not enforce a fixed grid. Choosing step="0.01" keeps a precision rule that matches currency, so a value with a third decimal place falls off the grid the attribute sets.
For a price in dollars and cents, 0.01 is usually the better match. Use step="any" when the field holds values whose precision you do not control. Either way, the browser check is only the first line of defense, so your server should still validate what it receives.
Bounding a discount between 0 and 1
Some price-related fields hold a fraction rather than a dollar amount, and a number field can keep them inside a fixed range. MDN's example creates a number control whose value is restricted to any value between 0 and 1 inclusive, and whose increase and decrease buttons change its value by 0.01.
The range keeps the value between 0 and 1, including both ends. In the quoted example, users who click the buttons move the number in hundredths, which is the same precision a price field would use for cents.
If you use this pattern for a discount, the label must say what the fraction means. A user who sees a box with no explanation may type a whole number, and the bounds will reject anything outside the range. Writing the unit in the label, and showing a short hint that the value is a fraction between 0 and 1, lets people enter the right kind of value the first time.
Which step setting should you pick?
Three step settings cover most price fields, and the right one depends on what a valid entry looks like. Leave the step out and the field accepts whole numbers only. Set step="0.01" and it accepts decimals on a hundredths grid. Set step="any" and it accepts decimals without a fixed step. MDN explains that to allow float numbers, you specify step="any" or a specific value, like step="0.01" to restrict the floating point.
For a monthly price in dollars and cents, step="0.01" is usually the right pick. A price is normally a value on a cent, so the grid matches the thing you are asking for.
Choose step="any" when the precision of the value varies and you do not want to force it onto a grid. Keep the default only when the answer is a count of whole units, such as seats.
A simple test settles most cases: ask whether a half cent or a third of a unit could ever be a correct answer. If it could not, the step should reject it. If the answer depends on the situation, step="any" is the honest setting.
Accessible price fields and W3C techniques
That guidance does not tell you which technique fits a given field, so the work falls to the team. Start with the markup you already have. A visible currency prefix or label is part of what the person sees, so make sure it is connected to the input and not just placed nearby by layout. The same goes for the unit or fraction hint on a discount field. A user who cannot see the box clearly should still hear what kind of value is expected.
Test the field the way a user would. Use the keyboard to reach it, enter a value that the step rejects, and see whether the error message names the problem in plain words. If the message only says the input is invalid, rewrite it to state the expected format, such as whole numbers or cents.
Treat the W3C techniques as a reference to check your choices against, not a checklist you tick once. When your form changes technology or framework, review the relevant examples again, since the right approach for one stack may not match another.
Applying the symbol rule on real forms
Start with each price or amount field and ask two questions. What does the visible cue suggest the person should type? And does the input accept exactly that? If the cue suggests a dollar sign and the field rejects it, the cue is working against the form. Move the symbol into the label, or into a prefix that sits outside the box, and keep the input for digits.
Next, check the pasted-value case. People copy prices from pricing pages, so a field may receive a value with a symbol, a comma or a unit attached. The guidance is clear that the input must include digits only, so decide before launch whether you will ask the person to correct the entry or clean it up on the server. Either way, decide it deliberately rather than leaving it to the browser.
Finally, review the wording of every field that takes an amount. Consistent labels across the form reduce the number of questions your support team receives.
Seat counts and whole-number fields
Seat counts are the case where the default step is the right answer. MDN notes that by default, the number input type only validates if the number is an integer, as the step attribute defaults to 1. A seat is a whole unit, so a field that rejects fractions matches what the form needs.
The default is useful here because it prevents an error that would make no sense. Nobody buys a fraction of a seat, so a field that asks for seats should accept only whole numbers. If you add a decimal step to a seat field by habit, you invite values the billing side cannot use.
The table below compares three common fields and the step each one needs.
| Field | Step setting | Why this setting fits |
|---|---|---|
| Seat count | Omitted (default 1) | Seats are whole units |
| Monthly price | step="0.01" | Prices are amounts on a cent grid |
| Discount fraction | step="0.01" with range 0 to 1 | Fractions use hundredths, as in the MDN example |
Read the table as a set of defaults to question, not rules to copy. Check each field against the value it holds. A seat field that copied the price field's step would accept values the form should refuse, and a price field that kept the seat default would refuse the cents your pricing requires.
Quick reference: step values and what they allow
This table gathers the step settings from the MDN guidance into one place. The entries show how each setting treats a whole number (1) and a hundredth (0.01). The discount row uses the range from the MDN example.
| Step setting | Typed 1 | Typed 0.01 | Notes |
|---|---|---|---|
| Omitted (step of 1) | Accepted | Not accepted | Only whole numbers are valid |
| step="0.01" | Accepted | Accepted | Decimals restricted to hundredths |
| step="any" | Accepted | Accepted | Decimals allowed with no fixed step |
| step="0.01" with min 0 and max 1 | Accepted | Accepted | Range runs 0 to 1 inclusive; buttons change by 0.01 |
Use the table to check a field before you ship it. Type each value into the field and compare the result with the row for its setting. If a value your business needs is rejected, the step is wrong for that field. If a value your business does not need is accepted, consider whether a tighter setting or range would prevent a bad entry.
Worked example: two price fields on one signup form
A signup form has a monthly price field and an annual price field. Each shows a dollar sign outside the box and a label stating the unit: "Monthly price (USD)" on one, "Annual price (USD)" on the other. Before launch, someone types a value with cents into each price field and confirms both submit.
Before you ship: your next step today
Open your signup form's markup and check every price field's step attribute. Set step="0.01" where the value carries cents, leave the step out on seat counts, and move any currency symbol out of the input into the label or an outside prefix. Then type a value with cents into each field and confirm it submits.
Related guides: 3 signup form field bug types and where to report each · How to gate a signup form by birth date with 3 conditions · Card trial costs: 3 parts of a payment form price.
Reader questions
Can I show a dollar sign inside the price box if I also add a label? No. The guidance says the user's input must include digits only, not units or a currency symbol. Show the currency as a prefix outside the input, or put it in the label, and keep the box for digits. U.S. Web Design System guidance covers this rule.
Is a dollar prefix ever the wrong choice? Yes. The guidance warns against a $ prefix on a question such as "What's a fair resolution?" when the person could answer "$1,000" or "a full refund." The prefix would push people toward a number they do not mean.
Why does a value with cents fail on my form? Most likely the step is still at its default. MDN states that the default step validates integers only, so a field that has no step rejects cents. Set step="0.01" or step="any" if the field should accept decimals.
Which step should I use for prices with cents? For dollars and cents, step="0.01" is the usual choice. Use step="any" when the precision of the value varies. MDN's guidance covers both settings.
Do prefixes change what the user types? They are meant to guide the entry, not to change the value. The guidance says prefixes and suffixes help users enter the right type of information, while the input itself still holds plain characters. Check that the cue and the expected entry agree, as the U.S. Web Design System describes.
What should I check for accessibility? Review the W3C's Sufficient Techniques for the technologies your form uses, as the Section508 guidance recommends. Confirm that the currency cue and the error message are connected to the input, and test the field with a keyboard.