Rounding Calculator
Round any number to decimal places or the nearest 0.05, 0.25 or 1,000 using half-up, banker's half-even, half-down, ceiling, floor or truncation.
Rounding Calculator
Background.
Round 2.5 to a whole number. Most people say 3, and so does Excel's ROUND function. Python's built-in round() says 2. Neither is broken: they follow different rules for the one case that needs a rule at all, a value sitting exactly halfway between two candidates. Every other value rounds to its nearer neighbour under any sensible scheme. Ties are where the conventions part company, along with the deliberately one-directional modes used for capacity, budgets and cash.
Six modes are offered. Half-up breaks a tie away from zero; it is school rounding, and the rule behind the IRS instruction that $2.50 becomes $3 on a whole-dollar return. Half-even sends a tie to the neighbour whose last digit is even — banker's rounding, and the default in IEEE 754 floating-point arithmetic. Half-down sends a tie toward zero. Ceiling always moves toward positive infinity, floor always toward negative infinity, and truncate simply drops the extra digits, which moves toward zero.
You can round to a number of decimal places, or to the nearest multiple of any step — 0.05 for Swiss cash, 0.25 for quarter-hours written in decimal hours, 1,000 for headline figures — and see how far the rounding moved the number, both in absolute terms and as a percentage of the original. The value is rounded as the decimal digits you typed, so 2.675 rounded half-up to two places gives 2.68, not the 2.67 that some programming languages return.
What is rounding calculator?
Rounding replaces a number with a nearby value on a coarser grid. Two choices define it. The first is the grid: a number of decimal places, where two places means steps of 0.01, or any step you name, such as 0.05 or 1,000. The second is the rule for choosing between the two grid points that bracket the value. For most values the nearer point is obvious, and all three half- modes agree; they differ only at an exact tie. Ceiling, floor and truncate ignore which point is nearer and always go one way, so their error can approach a whole step, while the half- modes never move a number by more than half a step. Decimal places are not the same as significant figures. Rounded to two decimal places, 0.0004567 becomes 0 — a 100 percent change — whereas two significant figures would keep 0.00046. For measured quantities spanning many orders of magnitude, significant figures are usually what you want. One more rule saves trouble: round once, from the original number. Rounding in stages can change the answer. Rounded half-up to one decimal, 2.45 becomes 2.5, and 2.5 rounded again to a whole number becomes 3 — yet 2.45 rounded straight to a whole number is 2, because it was never past the halfway point.
How to use this calculator.
- Enter the value to round. Anything from −1,000,000,000 to 1,000,000,000 is accepted, negative numbers included.
- Set the decimal places, a whole number from 0 to 10: 0 for whole numbers, 2 for cents, more for measurements.
- Choose a mode. Half-up matches school arithmetic and most spreadsheets; half-even avoids drift when many rounded values are added together; ceiling and floor are for answers that must not fall short or must not overshoot.
- To round to a step other than a power of ten, enter it as Round to nearest N and leave it at 1 otherwise. Once N is not 1, the Decimal places setting is ignored and the result is always an exact multiple of N, so a step of 0.125 gives answers such as 3.125 whatever the decimal places say.
- Read the rounded value with the difference beside it: a positive difference means the number was pushed up, a negative one that it was pulled down. The percent difference shows whether a small absolute change is large relative to the number.
The formula.
Call the grid step q: 10 to the power of minus the decimal places when the step N is 1, otherwise N itself. The value x lies between a lower grid point L and an upper grid point L + q. Half-up, half-even and half-down all pick whichever point is nearer; they differ only when x sits exactly in the middle, where half-up picks the point further from zero, half-down the point nearer zero and half-even the point whose last digit is even. Ceiling always takes the upper point unless x is already on the grid, floor always the lower, and truncate whichever is nearer zero.
With a step other than 1, the value is divided by N, that quotient is rounded to a whole number under the chosen mode, and the result is multiplied back by N. That product is the answer and is not rounded again, so it always lies exactly on the step and the decimal places setting plays no part: 3.14159 to the nearest 0.125 is 25.13272 steps, 25 under half-up, and 25 × 0.125 = 3.125 at any decimal-place setting.
The difference is the rounded value minus the original. The percent difference divides that by the size of the original and multiplies by 100; for an original of zero it is reported as 0.
The reason half-even exists is arithmetic. Half-up moves every tie upward, so a column of tied values drifts high when summed: 0.5, 1.5, 2.5 and 3.5 add up to 8, but rounded half-up they become 1, 2, 3 and 4, which add up to 10. Half-even rounds them to 0, 2, 2 and 4, which still add up to 8, because the ties go up and down in turn. That balance assumes even and odd neighbours occur about equally often among the ties, which is true of most real data.
No mode guarantees that rounded parts add up to the rounded whole. Three equal shares of a total are each 33.333… percent; rounded to one decimal they read 33.3, 33.3 and 33.3, which sum to 99.9. Published tables handle this either by noting that figures may not sum because of rounding or by adjusting the largest share so the column totals correctly.
A worked example.
Round 3.145 to two decimal places with half-up. The two candidates on the 0.01 grid are 3.14 and 3.15, and 3.145 sits exactly 0.005 from each, so the tie rule decides. Half-up moves away from zero, giving 3.15. The difference is 3.15 − 3.145 = +0.005, and the percent difference is 0.005 ÷ 3.145 × 100, about 0.159%. The same number under the other modes shows which rules actually differ. Half-even gives 3.14, because 4 is the even neighbour. Half-down also gives 3.14, moving toward zero. Ceiling gives 3.15, while floor and truncate both give 3.14. For a value such as 3.1452 there would be no tie at all: every nearest mode returns 3.15, and only floor and truncate would still give 3.14. Turn the sign around and the directed modes split. For −3.145, half-up gives −3.15 (away from zero), half-even and half-down give −3.14, ceiling gives −3.14 (toward positive infinity, which for a negative number means toward zero), floor gives −3.15, and truncate gives −3.14. A single cent separates the answers, which is nothing on one invoice and a visible bias on a ledger of thousands of tied amounts.
Frequently asked questions.
Why does Python round 2.5 down to 2?
Why does my code round 2.675 to 2.67, and 1.005 to 1.00?
When should I use banker's rounding instead of ordinary rounding?
How does each mode treat negative numbers?
How do I round a cash total to the nearest 5 cents or 10 cents?
How do I round work time to the nearest quarter hour?
Which mode gives a whole number of buses, boxes or tiles?
What is the difference between truncating and rounding down?
How should amounts on a US tax return be rounded?
What does the IEEE 754 standard say about rounding?
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.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 8 cited below
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled