LOG

Returns the logarithm of a number with respect to a base.

The mathematical base used by theLOG(X) function varies depending on the data source connector being used.

  • For BigQuery and most other connectors,LOG(X) computes the natural logarithm (basee).
  • For connectors such as Google Sheets, MySQL, PostgreSQL, Looker, and Extract Data,LOG(X) may default to base 2.

The functionLOG(X, base) with a second argument to specify the base is NOT supported.

Tip: For base 10 logarithms, use theLOG10(X) function. To calculate a logarithm with a different base 'B', you can use the change of base formula:LOG10(X) / LOG10(B).

Sample usage

LOG(256)

Syntax

LOG(value )

Parameter

value - The value for which to calculate the logarithm using base e (Euler's number).value must be a positive number.

Examples

Example formulaInputOutput
LOG(My field) 2.718281828459045 1
LOG(My field) 128 4.852030264

Related resources

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.