Rounding Calculator

Choose whether to round to decimal places or to the nearest multiple, pick the rounding rule, and see what every rule would give.

0 rounds to a whole number.
For example 10, 100, 0.5 or 0.25.
Half up is the schoolbook rule. The other rules are the IEEE 754 rounding directions.

Rounded value

1,234.57

As a number

1,234.57

Rounded minus original

0.0022

Every rule compared

Half up: 1,234.57 · Half to even: 1,234.57 · Floor: 1,234.56 · Ceiling: 1,234.57 · Truncate: 1,234.56

How it works

Rounding replaces a number with the nearest value on a coarser grid: whole numbers, hundredths, multiples of 100, or multiples of 0.5. Decimal places set the grid as a power of ten; the nearest-multiple option lets the grid be any step you like.

The rule only matters when the number sits exactly halfway between two grid points, or when you want to force the result in one direction. Half up (the schoolbook rule) moves a tie away from zero, so 2.5 becomes 3 and −2.5 becomes −3. Half to even moves a tie to whichever neighbour is even, so 2.5 becomes 2 and 3.5 becomes 4; it is used in accounting and in IEEE 754 arithmetic because it does not bias long sums upward.

Floor always rounds down (toward negative infinity), ceiling always rounds up, and truncate drops the extra digits, which is the same as floor for positive numbers and ceiling for negative ones.

The calculator rounds the decimal number you typed, not its binary approximation, so 1.005 to two places is 1.01 under half up even though many programming languages return 1.00.

Formula

decimal places p:   rounded = round(x × 10^p) ÷ 10^p
nearest multiple m: rounded = round(x ÷ m) × m
half up:    round(q) = sign(q) × ⌊|q| + 0.5⌋
half even:  ties go to the even neighbour
floor ⌊q⌋,  ceiling ⌈q⌉,  truncate = ⌊q⌋ for q ≥ 0, ⌈q⌉ for q < 0

Example

1,234.5678 to 2 decimal places: 1,234.5678 × 100 = 123,456.78, which rounds to 123,457 under half up, floor gives 123,456 and ceiling 123,457. Divided back by 100 the answers are 1,234.57 (half up, half even, ceiling) and 1,234.56 (floor, truncate). Half up adds 0.0022 to the original.

2.5 to a whole number is 3 under half up, 2 under half to even, 2 under floor, 3 under ceiling and 2 under truncate. −2.5 is −3 under half up, −2 under half to even, −3 under floor, −2 under ceiling and −2 under truncate.

1,250 to the nearest 100: 1,250 ÷ 100 = 12.5, a tie, so half up gives 13 × 100 = 1,300 and half to even gives 12 × 100 = 1,200. 7.3 to the nearest 0.5 is 7.5 because 7.3 ÷ 0.5 = 14.6 rounds to 15.

Assumptions and limitations

  • The number is treated as the exact decimal you typed. Ties are decided on that decimal, so 2.675 to two places is 2.68 under half up, whereas languages that round the binary value give 2.67.
  • "Half up" means ties away from zero (IEEE 754 roundTiesToAway), which is the usual schoolbook rule; some software uses "half up" to mean toward positive infinity, which differs only for negative ties.
  • Values are limited to ±1,000,000,000,000,000 and 0 to 15 decimal places, the range in which double-precision arithmetic keeps every digit shown.
  • Rounding a number to a multiple with many decimal places (such as 0.3333) displays as many places as the multiple has, up to 15.

Frequently asked questions

Why does my spreadsheet or program round 1.005 to 1.00?

Computers store 1.005 in binary as 1.00499999999999989…, which is just below the halfway point, so rounding that binary value gives 1.00. This calculator rounds the decimal digits you entered instead, which is what a person doing it by hand expects: 1.01.

When should I use half to even?

When you are rounding many values that will be added up, such as invoice lines or measurements. Always rounding ties up pushes the total slightly high; sending ties to the even neighbour rounds up and down equally often on average. It is the default rounding in IEEE 754 floating-point hardware and in many accounting systems.