Rounding Calculator
Free rounding calculator with six modes: half-up, half-even (banker's), half-down, ceiling, floor, truncate. Round to decimal places or nearest N.
Rounding Calculator
Background.
The Quanta rounding calculator is the single page you need for every rounding question, from school-style "round to two decimal places" to the banker's rounding that quietly governs your tax return, your invoice totals, and almost every scientific paper published in the last forty years. Most people meet rounding in primary school as a one-line rule — if the next digit is 5 or more, round up; otherwise round down — and never revisit it. That works fine for a homework sheet, but the moment you step into finance, statistics, engineering, or any code that handles money, you discover there are at least six legitimate rounding modes, the choice between them is not an opinion, and using the wrong one can systematically bias every total you produce. This calculator implements all six modes that matter — half-up, half-even (banker's), half-down, ceiling, floor, and truncate — and runs them through Decimal.js arbitrary-precision arithmetic so the answer you get is the mathematically exact one rather than whatever IEEE 754 binary float happens to be nearby.
Why does the choice of mode matter so much? Half-up — the school version — is biased upward on average. Round a hundred thousand values that all end in .5 with half-up and the sum will be measurably larger than the true sum. For a school quiz that's irrelevant; for a bank totalling a hundred thousand interest accruals, or a national statistics office aggregating census data, the bias compounds into real money and real policy errors. Half-even, also called banker's rounding, fixes this by breaking ties to the nearest even digit, which makes the upward and downward rounds cancel out over large samples. It is the default rounding mode of IEEE 754, the floating-point standard that every CPU on Earth implements, and it is the only mode permitted in the IEEE specifications for decimal arithmetic. The US Internal Revenue Service, the European Central Bank's TARGET2 settlement system, and the IRS Publication 1220 reporting specification all either mandate or recommend banker's rounding for the same reason: it preserves the sum.
There is a second, equally important reason this page exists, which is rounding to the nearest N. Switzerland abolished its one- and two-rappen coins, so every cash transaction in CHF must be rounded to the nearest 0.05 — what locals call rappen rounding. Australia and New Zealand do the same with five-cent and ten-cent steps. Markets round share prices to ticks of 0.01, 0.05, or 0.25 depending on the exchange. Schedulers round meeting times to the nearest 15 minutes.
The nearestN field handles all of these in one input: type 0.05 for Swiss cash, 0.25 for quarter hours, 5 for nearest five, 1000 for nearest thousand. Every other rounding calculator on the web silently uses JavaScript's built-in Math.round, which has a well-documented bug — Math.round(-0.5) returns 0 rather than −1 because it rounds halves toward positive infinity instead of away from zero — and which inherits all of float's accumulated rounding noise. Quanta does not.
The intro below walks through what each mode actually does, when to reach for it, and why the seemingly-academic distinction between half-up and half-even is worth caring about every time you write a financial report or seed a spreadsheet column.
What is rounding calculator?
Rounding is the process of replacing a number with a nearby number that has fewer significant digits or fewer decimal places. It is the universal compromise between precision (which costs storage, attention, and arithmetic time) and usability (which demands a short, readable answer). Every printed dollar amount, every reported temperature, every survey percentage, and every measurement on a product label has been rounded somewhere along the chain. The two questions every rounding rule has to answer are: where do we cut the number off, and what do we do when the dropped portion is exactly halfway between two possible answers? The first question is settled by the decimal-places or nearest-N parameter — you pick the granularity. The second question is what the six modes are for. Half-up rounds ties away from zero (1.5 → 2, −1.5 → −2). Half-down rounds ties toward zero (1.5 → 1, −1.5 → −1). Half-even rounds ties to whichever side has an even last digit (1.5 → 2, 2.5 → 2, 3.5 → 4) and is the IEEE 754 default. Ceiling always rounds toward positive infinity (1.1 → 2, −1.1 → −1). Floor always rounds toward negative infinity (1.1 → 1, −1.1 → −2). Truncate simply chops off the unwanted digits (1.9 → 1, −1.9 → −1). Modern numerical standards strongly prefer half-even because it is the only common mode that is statistically unbiased — over a large sample of half-ties, half-even produces a sum equal to the true sum, whereas the other half-modes systematically drift. That property is why it ended up in IEEE 754 and why anyone working with money, large datasets, or accumulated totals is well advised to use it.
How to use this calculator.
- Type the number you want to round in the Value field. Negative numbers, decimals as small as 1e-10, and numbers up to a billion are all handled with full Decimal.js precision.
- Set Decimal places to control the precision of the answer. 0 gives an integer, 2 is standard for currency, 4 or 6 are common in engineering. The maximum is 10 places.
- Choose a Rounding mode. If you don't know which to pick: half-up matches the rule taught in school and the way most spreadsheets behave by default; half-even is the right choice for financial reports, scientific aggregations, and any code that has to preserve sums.
- If you need to round to a multiple other than a power of ten — nearest 5 cents, nearest 25 minutes, nearest $1,000 — type that step into the Round to nearest N field. Leave it at 1 for ordinary decimal-place rounding.
- Read the four outputs: the Rounded value is the answer, the Difference from original tells you which way and how far the rounding moved the number, and the Percent difference puts that move in relative terms so you can spot when a small absolute change is actually a meaningful proportion of the original value.
The formula.
Each rounding mode is a deterministic mapping from a real number x to one of the two representable values surrounding it at the chosen precision. Let q be the precision step (10^(−decimalPlaces) when nearestN is 1, otherwise nearestN itself). Define the two candidate values as L = floor(x / q) × q and H = L + q. The modes choose between L and H as follows. Half-up: if x − L < q/2 pick L, if x − L > q/2 pick H, on a tie pick the one farther from zero. Half-down: same, but on a tie pick the one closer to zero. Half-even: same, but on a tie pick whichever has an even last digit. Ceiling: always pick H (or x itself if x = L). Floor: always pick L. Truncate: pick L if x ≥ 0, otherwise pick H — i.e. always move toward zero. When nearestN ≠ 1, the engine scales by dividing by nearestN, applies the chosen mode at zero decimal places (producing an integer multiple), then multiplies by nearestN, then re-applies the decimal-places precision to clean up any binary-float noise from the multiplication. All of this runs through Decimal.js, whose internal representation is a coefficient plus a power-of-ten exponent, so values like 0.1 and 0.2 are represented exactly rather than as the IEEE 754 approximations 0.1000000000000000055... that JavaScript's native Number uses. The practical consequence is that 3.145 rounded to two decimal places with half-up genuinely returns 3.15 — what most people would call "the right answer" — whereas a naive (3.145).toFixed(2) in JavaScript returns 3.14, because the binary representation of 3.145 is actually slightly less than 3.145 and the half-up rule strictly rounds down. This is the canonical JavaScript Math.round bug, documented at length on MDN and in countless Stack Overflow posts, and it is the reason every serious financial calculator uses arbitrary-precision decimal arithmetic instead of the built-in float.
A worked example.
Take the textbook tricky case: round 3.145 to two decimal places. With mode half-up, the third decimal is exactly 5, so the tie-breaker activates and pushes away from zero, yielding 3.15. Switch the mode to half-even and the same input returns 3.14, because the digit to the left of the tie (the 4 in 3.14) is even, so banker's rounding stays put rather than rolling up to an odd 5. That single decision — 3.14 versus 3.15 — is one cent on this transaction, but multiplied across a million transactions it is the difference between a balanced ledger and a slow upward drift that auditors will eventually flag. As a separate example, switch the value to 27.43, set the mode back to half-up, set decimal places to 2, and set Round to nearest N to 0.05. The engine scales 27.43 by 0.05 to get 548.6, rounds that to the nearest integer with half-up (549), then unscales by multiplying by 0.05 to get 27.45 — the Swiss-rappen cash rounding result. The difference from the original is +0.02, or about +0.073%, which is the small but real cost of cash rounding versus exact billing.
Frequently asked questions.
When should I use banker's rounding (half-even) instead of normal rounding (half-up)?
Why does JavaScript's Math.round give wrong answers for negative halves?
How does negative-number rounding work in each mode?
What is the Swiss 5-cent (rappen) rounding rule and how do I model it here?
Why is half-even called banker's rounding?
What is the difference between rounding and truncation?
Does this calculator use floating-point or fixed-point arithmetic?
How should I round amounts that I'm reporting on a tax form like a 1099?
What does IEEE 754 say about rounding?
When should I use ceiling or floor instead of one of the half-modes?
References& sources.
- [1]IEEE Std 754-2019, IEEE Standard for Floating-Point Arithmetic, §5.4.1 — definitions of the five standard rounding-direction attributes including roundTiesToEven (the default).
- [2]Knuth, D. E. The Art of Computer Programming, Volume 2: Seminumerical Algorithms, §4.2.1 — floating-point arithmetic, the statistical bias of half-up versus half-even, and the convergent (banker's) rounding argument.
- [3]ANSI/IEEE Std 754-2008 — predecessor standard, §4 on rounding-direction attributes; widely cited in numerical-analysis literature and still referenced by most language specifications.
- [4]Swiss National Bank — "Notes and coins: Withdrawal of the 1- and 2-rappen pieces" — official background on Swiss 5-rappen cash rounding, the regulatory basis for nearest-0.05 rounding on cash payments in CHF.
- [5]IETF RFC 7159, The JavaScript Object Notation (JSON) Data Interchange Format, §6 — discussion of number precision and the recommendation to limit interoperable JSON numbers to IEEE 754 double-precision range, which is why language-native rounding is unreliable for high-precision values.
- [6]Internal Revenue Service Publication 1220 — Specifications for Electronic Filing of Forms 1097, 1098, 1099, 3921, 3922, 5498, and W-2G — Part C on amount fields and the rounding rules accepted for aggregated information returns.
- [7]Mozilla Developer Network — Math.round() reference — documents that JavaScript's built-in Math.round rounds halves toward positive infinity rather than away from zero, the canonical "JavaScript rounding bug" that motivates arbitrary-precision libraries.
- [8]NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6 — discussion of rounding conventions in statistical reporting and the preference for unbiased (banker's) rounding when totals are reported alongside individual values.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled