Browsers & softwarePractical guides

Why a number input rejects 3.5: min, step and the step base

Being inside a numeric range does not establish that a value lies on the input’s permitted increments. An ordinary number input defaults to a step of 1, but the starting point matters too. Inspect the validity flags before changing the step, minimum or intended rule.

Physical calculator on a white table
Illustrative photo: Ben Wicks · Unsplash LicenseStock illustration for the topic, not a screenshot, test of the pictured equipment or product recommendation.

Key Takeaways

With min=0, no step and no initial value attribute, 3.5 produces stepMismatch. Use step=0.5 for an intended half-unit increment. With min=0.2 and step=1, 3.2 fits while 3.5 does not. step=any removes the increment constraint, while min, max and business rules remain.

In this article

Separate range from permitted increments

The step reference describes the base for a number input: min takes precedence, then the value attribute, otherwise usually zero. This article does not apply date/week exceptions to number inputs. A control’s current value and its initial HTML value attribute are different.

A default step does not necessarily mean integers only. With min=0.2 and step=1, the sequence includes 0.2, 1.2, 2.2 and 3.2. Changing min can alter both the range and the base; do not change a business minimum merely to remove a message.

Inspect six isolated controls

On December 1, 2026, the editor created controls in an isolated Edge 158.0.4370.45 context, set their constraints and then assigned current values. None had an HTML value attribute. These were local validity checks without submitting a form to any website.

Observed validity with no initial value attribute
minstepCurrent valueResult
0Omitted; defaults to13.5stepMismatch=true
00.53.5Valid
0.213.2Valid
0.213.5stepMismatch=true
0.2any3.5Valid
0; max=10any11rangeOverflow=true; stepMismatch=false

Change the intended rule, then recheck

If the quantity must be whole items, retain the increment and ask for a different value. Set step=0.5 only when half units are intended. Use any for unrestricted increments only when appropriate, preserving separate range, precision and business checks. Hiding the message does not repair a contract.

The ValidityState reference identifies increment, range and missing-value flags separately. On your own test page, give the control id="quantity" and inspect it with the following record. Browser language can change the displayed error message.

Inspect the control without changing or submitting it

const input = document.querySelector("#quantity");
console.table({
  value: input.value,
  min: input.min,
  step: input.step,
  stepMismatch: input.validity.stepMismatch,
  rangeOverflow: input.validity.rangeOverflow,
  valid: input.checkValidity()
});
Use on a page you can test. checkValidity can emit invalid events; it does not call a server.

Separate a valid control from successful submission

The frontend-validation guide explains why servers still need validation. An optional empty field may not fail a step constraint. An accepted quantity does not prove permission, available stock or a completed save.

For a keyboard barrier, record the route with the focus and keyboard checks. Preserve exact attributes and reproduction inputs using the HTML/code-content checks. This specimen is not a site-wide accessibility or business-security certification.

Further reading & sources

Newer articles on this topic

Continue with a newer article that refers to this guide or explainer.