Request a demo

BigQuery · Conversion function

BigQuery PARSE_NUMERIC

PARSE_NUMERIC(string) converts a STRING to NUMERIC and, unlike CAST, accepts thousands separators, spaces and a trailing minus sign, as in '1,234.50' or '75.10-'. Use it for amounts exported from spreadsheets, ERP systems and reports.

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

CAST to NUMERIC accepts only a plain numeric literal. PARSE_NUMERIC is more forgiving about layout: commas in the integer part ('1,234.50'), whitespace around the number and between the sign and the digits (' - 12.5 '), a sign after the number ('75.10-', a layout some ERP exports use), and exponents ('1.5e3'). Spaces between digits are still invalid.

It is not a general cleaner. Currency symbols, letters, parentheses for negatives ('(80.00)') and European formats where the comma is the decimal mark ('1.234,56') all fail; strip or swap characters first with REPLACE or REGEXP_REPLACE. Invalid input raises "Invalid input to PARSE_NUMERIC", while SAFE.PARSE_NUMERIC returns NULL instead.

The result is NUMERIC, with up to 9 digits after the decimal point. Extra digits are rounded half away from zero, and values beyond the NUMERIC range (about ±10^29) fail. For more precision or range, PARSE_BIGNUMERIC follows the same input rules with up to 38 decimal places.

Syntax

PARSE_NUMERIC(string_expression)

Arguments and return value

ArgumentDescription
string_expressionA STRING holding a number: digits, commas before the decimal point, one decimal point, one sign before or after the number, an optional exponent, and whitespace anywhere except between digits.

Returns: NUMERIC. NULL if the input is NULL.

Examples

Layouts that CAST rejects

SELECT
  PARSE_NUMERIC('1,234.50') AS thousands_separator,
  PARSE_NUMERIC(' - 12.5 ') AS spaced_sign,
  PARSE_NUMERIC('12.5-') AS trailing_sign,
  PARSE_NUMERIC('1.5e3') AS exponent,
  SAFE_CAST('1,234.50' AS NUMERIC) AS cast_result;
Result
thousands_separatorspaced_signtrailing_signexponentcast_result
1234.5-12.5-12.51500NULL

Rounding beyond 9 decimal places

Both values round half away from zero at the ninth decimal.

SELECT
  PARSE_NUMERIC('0.1234567895') AS rounded_to_9_places,
  PARSE_NUMERIC('-0.0000000005') AS tiny_negative;
Result
rounded_to_9_placestiny_negative
0.12345679-0.000000001

Clean an ERP export

SAFE.PARSE_NUMERIC flags the value with a currency symbol; removing the symbol first makes every row parse.

WITH erp_export AS (
  SELECT 'INV-1' AS invoice_id, '1,250.00' AS amount_text UNION ALL
  SELECT 'INV-2', '$980.40' UNION ALL
  SELECT 'INV-3', '75.10-'
)
SELECT
  invoice_id,
  SAFE.PARSE_NUMERIC(amount_text) AS parsed_as_is,
  PARSE_NUMERIC(REGEXP_REPLACE(amount_text, r'[$€£]', '')) AS parsed_clean
FROM erp_export
ORDER BY invoice_id;
Result
invoice_idparsed_as_isparsed_clean
INV-112501250
INV-2NULL980.4
INV-3-75.1-75.1

European decimal commas

Drop the thousands dots, then turn the decimal comma into a point.

SELECT
  SAFE.PARSE_NUMERIC('1.234,56') AS european_as_is,
  PARSE_NUMERIC(REPLACE(REPLACE('1.234,56', '.', ''), ',', '.')) AS european_fixed;
Result
european_as_iseuropean_fixed
NULL1234.56

Common mistakes

  • Expecting currency symbols or codes to be ignored. '$12.34' fails with "Invalid input to PARSE_NUMERIC"; remove them with REGEXP_REPLACE first.
  • Parsing European amounts directly. In '1.234,56' the comma after the decimal point is invalid; swap the separators before parsing.
  • Feeding accounting negatives in parentheses. '(80.00)' fails; rewrite it as '-80.00' first.
  • Forgetting the result is NUMERIC. Wrap it in CAST(... AS INT64) when you need an integer, which rounds any fraction half away from zero.
  • Parsing values beyond NUMERIC's range. They fail; use PARSE_BIGNUMERIC.

FAQ

How do I convert a string with commas to a number in BigQuery?

PARSE_NUMERIC('1,234.50') returns 1234.5 as NUMERIC, where CAST fails on the comma. Use SAFE.PARSE_NUMERIC if some rows may be invalid.

What is the difference between PARSE_NUMERIC and CAST AS NUMERIC?

Both return NUMERIC and round past 9 decimal places. PARSE_NUMERIC also accepts thousands separators, spaces around the sign and a trailing sign; CAST accepts only a plain numeric literal.

How do I parse a number with a trailing minus sign?

PARSE_NUMERIC handles it directly: PARSE_NUMERIC('75.10-') returns -75.1.

All BigQuery conversion 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.