Rounding Calculator
Round a number to chosen decimal places.
Inputs
Loading calculator…
Calculating…
Was this helpful?
Formula
Rounded = round(value × 10^d) ÷ 10^d, where d = decimal places
The number is shifted by 10^d, rounded to the nearest integer using standard 'half up' rounding, then shifted back. This is the same rule most calculators and spreadsheets use.
Worked example
3.14159 rounded to 2 decimal places is 3.14 — multiply by 100 to get 314.159, round to 314, divide by 100.
Where this can give the wrong answer
- Decimal places must be a whole number from 0 to 10 — asking for 2.5 decimal places or 15 places returns an error.
- Rounding 2.675 to 2 decimal places can surprise you: floating-point storage may make the value slightly below 2.675, producing 2.67 instead of the pencil-and-paper 2.68 — a known limitation of binary floating-point, not a bug in the rounding rule itself.
- Negative decimal places aren't supported — to round to the nearest 10 or 100, use 0 decimal places on a pre-scaled number or round manually.
FAQ
- Standard round-half-up via Math.round — 2.5 rounds to 3, 3.5 rounds to 4. Banker's rounding (round half to even) is common in finance for reducing bias over many operations; this calculator doesn't use it.