Request a demo

BigQuery · Math function

BigQuery CEIL / CEILING

CEIL(x) returns the smallest whole number that is not less than x: CEIL(2.1) is 3.0 and CEIL(-2.9) is -2.0. CEILING is a synonym. INT64 and FLOAT64 inputs return FLOAT64, so cast the result when you need an integer count such as billable minutes.

GoogleSQL for BigQuery · Checked against the official reference in November 2026

CEIL rounds up toward positive infinity. Positive fractions go to the next whole number and negative fractions go toward zero: CEIL(-2.9) is -2.0. CEILING is the same function under another name.

CEIL has no digits argument. To round up to two decimals, scale, round up and scale back: CEIL(x * 100) / 100. Do this on NUMERIC values. In FLOAT64, 1.1 * 100 is 110.00000000000001, so CEIL(1.1 * 100) / 100 returns 1.11 instead of 1.1.

The result is FLOAT64 for INT64 and FLOAT64 input and stays NUMERIC or BIGNUMERIC for those types. Typical uses are counts that must round up, such as billable minutes or the number of batches: CAST(CEIL(row_count / 500) AS INT64). Because / already returns FLOAT64 in BigQuery, CEIL(7 / 2) is 4.0 without casting the inputs.

Syntax

CEIL(X)

CEILING(X)

Arguments and return value

ArgumentDescription
XINT64, NUMERIC, BIGNUMERIC or FLOAT64.

Returns: FLOAT64 for INT64 or FLOAT64 input, NUMERIC for NUMERIC and BIGNUMERIC for BIGNUMERIC.

Examples

Positive, negative and whole inputs

SELECT
  CEIL(2.1) AS up,
  CEIL(-2.9) AS negative,
  CEIL(7) AS from_int64,
  CEILING(4.0) AS already_whole;
Result
upnegativefrom_int64already_whole
3.0-2.07.04.0

Billable minutes

Any started minute counts. CAST turns the FLOAT64 result into INT64.

WITH calls AS (
  SELECT 'call-1' AS call_id, 59 AS duration_s UNION ALL
  SELECT 'call-2', 60 UNION ALL
  SELECT 'call-3', 61
)
SELECT
  call_id,
  CAST(CEIL(duration_s / 60) AS INT64) AS billable_minutes
FROM calls
ORDER BY call_id;
Result
call_idbillable_minutes
call-11
call-21
call-32

Round up to cents: FLOAT64 vs NUMERIC

1.1 * 100 in FLOAT64 is slightly above 110, so CEIL jumps to 111. The NUMERIC calculation is exact.

SELECT
  CEIL(1.1 * 100) / 100 AS float64_cents,
  CEIL(NUMERIC '1.1' * 100) / 100 AS numeric_cents;
Result
float64_centsnumeric_cents
1.111.1

Common mistakes

  • Expecting INT64. CEIL(7) is 7.0 (FLOAT64); use CAST(CEIL(x) AS INT64) for counts and keys.
  • Rounding up FLOAT64 decimals with CEIL(x * 100) / 100. Binary representation errors can add a cent (1.1 becomes 1.11); cast to NUMERIC first.
  • Assuming CEIL moves negative numbers away from zero. CEIL(-2.5) is -2.0, because CEIL always goes toward positive infinity.
  • Applying CEIL after integer division. CEIL(DIV(7, 2)) is 3.0 because DIV already dropped the remainder; use CEIL(7 / 2).

FAQ

What is the difference between CEIL and CEILING in BigQuery?

None. CEILING is a synonym for CEIL, with the same argument and return types.

How do I round up to 2 decimal places in BigQuery?

Use CEIL(x * 100) / 100 on a NUMERIC value, for example CEIL(CAST(price AS NUMERIC) * 100) / 100. ROUND can't force the direction.

How do I get an integer from CEIL?

Cast it: CAST(CEIL(x) AS INT64). CEIL returns FLOAT64 for INT64 and FLOAT64 input, even when the value is whole.

More mathematical functions

All BigQuery mathematical functions · All functions · BigQuery error messages

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.