Rounding Calculator (Nearest Place Value)

Pick a place — hundredths, whole numbers, nearest thousand — choose a tie-breaking rule, and this calculator rounds your number and shows you the digit it examined to decide. It runs all six common rules side by side, because they only disagree on exact halves and that disagreement is where money and lab data go wrong. Half away from zero is what school teaches; half to even is what IEEE 754 hardware and most accounting standards use; ceiling, floor and truncation ignore the tie entirely. The difference from the original value is reported so you can see what the rounding cost.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Number to roundAny value, positive or negative. Enter it at full precision; rounding partway through loses accuracy.3.14159
Round toPositive values count decimal places to the right of the point; negative values round to a place value on the left.2 decimal places (hundredths)
Tie-breaking ruleOnly matters when the part being discarded is exactly half a unit of the rounding place, except for the last three which ignore the digit entirely.Half away from zero (the usual school rule)

It returns

  • Rounded value — Shown with exactly the number of decimal places you asked for, including trailing zeros.
  • Difference from the original — Rounded minus original. Negative means the value was rounded down.
  • Rounding error — The size of the change as a percentage of the original value.
  • Digit examined — The first digit to the right of the rounding place — the one the rule looks at.
  • Size of one unit in that place

The formula

round(x,d)=f(x10d)10d
f(y)=sgn(y)|y|+0.5

In plain text: round(x, d) = f(x · 10^d) / 10^d, where f is the chosen rounding rule

  • xThe value being rounded (any)
  • dDecimal places; negative for place values to the left of the point (integer)
  • fThe rule that maps the shifted value to an integer (—)

Shifting by a power of ten turns any rounding place into a whole-number rounding problem, which is why one formula covers hundredths and thousands alike.

Updated Category Fractions, Decimals & Rounding Verified against published test cases Reading time 12 min

What rounding does, and what it costs

Rounding replaces a number with the nearest value that can be written at a chosen place. It is a deliberate loss of information, and the only interesting questions about it are how much you lost and what happens when two candidates are equally near.

Every rounding operation has the same shape. Shift the number so that the place you care about becomes the ones place, turn the shifted value into an integer, then shift back. Rounding 3.14159 to hundredths means multiplying by 100 to get 314.159, deciding between 314 and 315, and dividing back. Rounding 1,234.5678 to the nearest hundred means dividing by 100 to get 12.345678, deciding between 12 and 13, and multiplying back. One mechanism, one formula, whichever direction the place lies.

The cost is bounded and predictable. Under any nearest-value rule the error is at most half a unit of the rounding place: rounding to hundredths can move a value by no more than 0.005, rounding to the nearest thousand by no more than 500. Under truncation the bound is a full unit, and truncation is always biased toward zero rather than error-free on average, which is why it belongs in computing rather than in reporting.

What makes rounding worth a calculator is the tie. When the discarded part is exactly half a unit, the two candidates are equally close and the arithmetic gives you no reason to prefer either. Every rule you have ever heard of is a different answer to that question, and they disagree by a full unit of the rounding place.

The six rules and where each one belongs

Half away from zero. Ties go to the candidate further from zero: 2.5 becomes 3, −2.5 becomes −3. This is the rule taught in schools and the one most people mean by “rounding”. It is symmetric about zero, which is its main virtue, but it is biased upward in magnitude: across a long run of ties, every one of them inflates the total.

Half to even, or banker's rounding. Ties go to whichever candidate is even: 2.5 becomes 2, 3.5 becomes 4, −2.5 becomes −2. Because even and odd neighbours occur about equally often in real data, the upward and downward pushes cancel over many operations instead of accumulating. This is the default rounding mode specified by IEEE 754 for binary floating-point arithmetic, so it is what your processor does unless told otherwise, and it is the rule most accounting and statistical conventions adopt for the same bias argument.

Half up, toward positive infinity. Ties always move up the number line: 2.5 becomes 3 and −2.5 becomes −2. Note the asymmetry — this is not the school rule, and the two differ on every negative tie. Spreadsheet and database rounding functions differ on which of these two they implement, which is a genuine source of reconciliation errors between systems.

Ceiling and floor. These ignore ties because they ignore the discarded digits: ceiling always moves up, floor always moves down, at any value. Ceiling is what you want for sizing — how many buses, how many sheets of plywood — where a fractional answer means you need the next whole one. Floor is what you want for capacity limits you must not exceed.

Truncation. Cut the digits off and keep what is left, which moves the value toward zero: 3.999 truncated to one decimal is 3.9, and −3.999 is −3.9. This is what integer division does in most programming languages and what a display does when it simply stops printing. It is never appropriate for reporting a measurement, because its error is up to twice that of nearest-value rounding and always in the same direction relative to zero.

Worked example: 3.14159 to two decimal places, then a tie

The straightforward case. Round 3.14159 to hundredths.

  1. Identify the place. Two decimal places means one unit of the rounding place is 10⁻² = 0.01.
  2. Shift. 3.14159 × 100 = 314.159.
  3. Look at the leftover. The fractional part is 0.159, which is less than 0.5, so the nearer integer is 314. Equivalently, the digit immediately right of the hundredths place is 1.
  4. Shift back. 314 ÷ 100 = 3.14.
  5. Cost. 3.14 − 3.14159 = −0.00159, which is 0.00159 ÷ 3.14159 = 0.000506, or 0.0506% of the original. Well inside the half-unit bound of 0.005.

Every rule except ceiling gives 3.14 here, because there is no tie to break: ceiling gives 3.15 because it always moves up.

The tie. Now round 2.5 to a whole number. The fractional part is exactly 0.5, so 2 and 3 are equally close and the rules split:

  • Half away from zero → 3.
  • Half to even → 2, because 2 is the even neighbour.
  • Half up → 3.
  • Ceiling → 3; floor → 2; truncate → 2.

Change the sign and the split changes with it. For −2.5: half away from zero gives −3, half up gives −2, half to even gives −2, ceiling gives −2, floor gives −3, truncate gives −2. The school rule and the half-up rule agree on every positive tie and disagree on every negative one, which is exactly the kind of discrepancy that shows up as a one-penny difference between two systems reconciling the same ledger.

A place value to the left. Round 1,234.5678 to the nearest hundred. Divide by 100 to get 12.345678; the fractional part 0.345678 is below 0.5, so take 12; multiply back to get 1,200. The digit examined is the tens digit, 3. The change is −34.5678, comfortably within the half-unit bound of 50.

Choosing a rule and reading the error

Match the rule to the consequence of being wrong. If a fractional answer means you need one more of something, use ceiling — 4.1 buses is 5 buses, and no tie-breaking rule will save a stranded passenger. If exceeding a limit is unacceptable, use floor. If you are reporting a measurement, use a nearest-value rule, and prefer half to even when the numbers will be summed, because that is the case where a systematic tie bias compounds.

Round once, at the end. Rounding intermediate results and then rounding again accumulates error that a single rounding would not produce. A value rounded to hundredths and then to tenths can land a full step away from where the original would have gone: 2.45 rounds to 2.5 and then to 3 under the school rule, while 2.45 taken straight to a whole number gives 2. This is called double rounding, and it is why standards for financial and scientific reporting specify rounding from the unrounded original.

Read the rounding error as a percentage when scale varies. Losing 0.005 from a value of 3.14 is 0.16%; losing the same 0.005 from a value of 0.01 is 50%. The absolute bound is fixed by the place, so the relative damage grows as the value shrinks. This is the argument for rounding to significant figures rather than to decimal places whenever your data spans orders of magnitude — significant figures fix the relative precision instead of the absolute one.

Expect binary surprises at exact halves. Decimal fractions such as 0.1, 2.675 and 1.005 have no exact binary representation, so what a computer stores is a hair above or below what you typed. Ask a naive routine to round 1.005 to hundredths and it may return 1.00, because the stored value is fractionally below the tie. This calculator treats a value within a rounding error of a tie as a tie, so it answers the question you asked rather than the one the hardware stored, and it tells you when it has done so.

How the six rules treat the same values

All values rounded to a whole number. The nearest-value rules differ only on the three exact halves; ceiling, floor and truncation differ everywhere.
ValueHalf away from zeroHalf to evenHalf upCeilingFloorTruncate
0.5101100
1.5222211
2.5323322
2.4222322
−0.5−1000−10
−1.5−2−2−1−1−2−1
−2.5−3−2−2−2−3−2
−2.4−2−2−2−2−3−2

Half away from zero and half up agree on every positive tie and disagree on every negative one. Half to even sends 0.5 and 2.5 down but 1.5 and 3.5 up, which is how it avoids a net bias.

Rounding mistakes that change an answer

  • Double rounding. Rounding to an intermediate place and then rounding again can land a whole step away from rounding the original once. Always round from the unrounded value.
  • Assuming half up and half away from zero are the same rule. They agree on positive numbers and disagree on every negative tie, which is a classic cause of one-cent reconciliation differences between two systems.
  • Rounding before an operation instead of after. Rounding each item on an invoice and then summing gives a different total from summing and rounding once. Tax authorities specify which order applies; the difference is real money.
  • Using truncation as if it were rounding. Truncation has twice the worst-case error and is systematically biased toward zero, so a column of truncated values is a column with a known downward bias in magnitude.
  • Rounding to a fixed number of decimal places across data that spans orders of magnitude. Two decimals is generous for 0.004 and meaningless for 4,000,000. Use significant figures when the scale varies.
  • Reporting more places than the measurement supports. Rounding cannot add precision. A reading good to three digits is not made better by writing six.
  • Rounding percentages that must sum to 100. Rounding each share independently often produces 99.9% or 100.1%. Round the shares and then correct the largest one, or state that the figures do not sum because of rounding.

Rounding, significant figures and the standards that govern them

Rounding to a decimal place fixes the absolute precision of the result; rounding to significant figures fixes the relative precision. Which one you want depends on whether the meaningful error in your data is a fixed size or a fixed proportion. Currency is absolute — a cent is a cent whether the invoice is for £5 or £5,000 — so money is rounded to decimal places. Physical measurements are usually relative, because instrument error scales with reading, so measurements are reported to significant figures. The significant figures calculator handles that second case, including the awkward question of how many digits survive a multiplication.

Several documents set the rules explicitly. IEEE 754 defines five rounding-direction attributes for floating-point arithmetic, with roundTiesToEven as the default for binary formats — this is why the same calculation can differ in the last bit between a language that uses the hardware default and one that implements a decimal rule in software. ISO 80000-1 gives rounding conventions for quantities and units, and NIST Special Publication 811 gives the corresponding guidance for reporting SI measurements, including the advice to carry extra digits through a calculation and round only the final result.

Two neighbouring operations often get confused with rounding. Truncating a display is not rounding: a readout that shows 3.14 for a stored 3.14159 has rounded, while one that shows 3.14 for a stored 3.149 has truncated, and you usually cannot tell which from the display alone. Converting to a fraction is a different approximation entirely — the decimal to fraction calculator finds the nearest fraction with a bounded denominator, which can be closer than any decimal rounding of the same length, and the fraction to decimal calculator goes the other way and shows you where the repeating block starts.

Finally, if you need the rounding error quantified against a reference rather than against the original, that is the same arithmetic as percent error: the difference divided by the accepted value. Rounding is simply the case where you introduced the error deliberately and know its bound in advance.

Frequently asked questions

What is banker's rounding and why would I use it?

Banker's rounding sends exact ties to the even neighbour, so 2.5 becomes 2 and 3.5 becomes 4. Because even and odd neighbours turn up about equally often, the ties push up as often as they push down and the bias cancels over many values. Rounding half away from zero pushes every tie up in magnitude, so a long column of ties drifts upward. IEEE 754 makes half-to-even the default rounding mode for binary floating point for the same reason.

Does 0.5 round up or down?

It depends entirely on the rule. Half away from zero and half up both give 1; half to even gives 0 because 0 is even; floor and truncation give 0; ceiling gives 1. There is no arithmetic reason to prefer either candidate, because both are exactly half a unit away, so any answer is a convention rather than a calculation. Say which convention you used whenever it could matter.

How do I round to the nearest hundred or thousand?

Choose the negative place from the list: nearest hundred is −2, nearest thousand is −3. The arithmetic is the same as for decimal places, but you divide first instead of multiplying. For 1,234.5678 to the nearest hundred, divide by 100 to get 12.3457, round to 12, and multiply back to 1,200. The digit that decides is the tens digit, and one unit of the rounding place is 100.

Why does rounding 1.005 to two decimals sometimes give 1.00?

Because 1.005 has no exact binary representation, so a computer stores a value a fraction below it, and a naive routine correctly rounds that stored value down. This calculator treats a value within a rounding error of a tie as a tie, so it returns 1.01 under half-away-from-zero and tells you that it made that judgement. If exact decimal behaviour matters — in currency, for instance — use a decimal arithmetic type rather than binary floating point.

Should I round each line of an invoice or only the total?

Whichever your tax authority specifies, and the two give different answers. Rounding each line and summing accumulates up to half a unit of error per line; summing first and rounding once bounds the error at half a unit overall. Neither is more correct in the abstract, but mixing the two across systems produces reconciliation differences that are tedious to trace, so pick one and apply it everywhere.

What is the largest error rounding can introduce?

Half a unit of the rounding place under any nearest-value rule, and a full unit under truncation, ceiling or floor. Rounding to hundredths can move a value by at most 0.005; rounding to the nearest thousand by at most 500. As a percentage the damage depends on the size of the value: 0.005 is 0.16% of 3.14 and 50% of 0.01, which is the argument for using significant figures when your data spans orders of magnitude.

What is the difference between rounding and truncating?

Rounding picks the nearest representable value; truncation simply discards the digits beyond the place, which always moves the value toward zero. 3.999 rounds to 4 and truncates to 3 at whole numbers. Truncation has twice the worst-case error and is systematically biased, so it is appropriate for integer division and display cut-offs but not for reporting measurements or money.

Why do my rounded percentages not add up to 100?

Because each share was rounded independently and the individual errors do not cancel. Three shares of 33.33% round to 33.3% each and total 99.9%. The usual fixes are to round all but the largest share and give the remainder to it, or to state plainly that components may not sum to the total because of rounding. Do not adjust a component silently, because the adjusted figure then no longer matches its own source.

References