Floor and Ceiling Calculator
The floor of a number rounds it down to the largest integer no greater than it, and the ceiling rounds it up to the smallest integer no less than it. These two functions turn any decimal into a whole number in a predictable direction, which is exactly what you need when packing items into boxes, paginating results, or scheduling whole units of time. This tool returns the floor, the ceiling, the nearest-integer rounding, and the fractional part of any number you enter, handling positive and negative values correctly.
Floor and ceiling formula
Floor(x) = largest integer less than or equal to x
Ceiling(x) = smallest integer greater than or equal to x
Nearest integer = round(x)
Fractional part = x - floor(x)
Here x is your number. Floor rounds toward negative infinity, ceiling rounds toward positive infinity, and the fractional part is what remains above the floor.
How floor and ceiling work
- Floor rounds down to the largest integer not exceeding the number.
- Ceiling rounds up to the smallest integer not below the number.
- For an exact integer, floor, ceiling, and rounding all return that integer.
- Floor and ceiling round toward infinity, unlike truncation which rounds toward zero.
- Ceiling tells you how many whole units are needed; floor tells you how many fit.
Floor and ceiling: frequently asked questions
What is the floor of a number?
The floor of a number is the largest integer that is less than or equal to it. The floor of 3.7 is 3, and the floor of -3.2 is -4, because -4 is the largest integer not exceeding -3.2. The floor function always rounds down toward negative infinity.
What is the ceiling of a number?
The ceiling of a number is the smallest integer that is greater than or equal to it. The ceiling of 3.2 is 4, and the ceiling of -3.7 is -3, because -3 is the smallest integer not below -3.7. The ceiling function always rounds up toward positive infinity.
How do floor and ceiling differ from ordinary rounding?
Ordinary rounding goes to the nearest integer, choosing up or down based on the fractional part. Floor always rounds down and ceiling always rounds up, regardless of the fraction. For an exact integer, floor, ceiling, and rounding all return that same integer.
How do floor and ceiling treat negative numbers?
Floor rounds toward negative infinity, so the floor of -2.1 is -3. Ceiling rounds toward positive infinity, so the ceiling of -2.9 is -2. This is different from truncation, which rounds toward zero, so the two functions can disagree with truncation for negative inputs.
Where are floor and ceiling used?
Floor and ceiling appear when distributing items into whole units: ceiling tells you how many boxes you need to hold a quantity, while floor tells you how many full groups fit. They are also used in pagination, scheduling, indexing, and any calculation that must produce a whole number.
Official sources
- National Institute of Standards and Technology: Digital Library of Mathematical Functions: notation and algebra.
- National Aeronautics and Space Administration: Mathematics reference.
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.