Category: FUNCTION | Updated: 2026-11-22

How to Use the DECIMAL Function in Google Sheets | Base Conversion Basics and Examples

How to Use the DECIMAL Function in Google Sheets

The DECIMAL function converts a text representation of a number in a specified base (such as binary or hexadecimal) into a standard base-10 (decimal) number. It is useful for analyzing system logs and converting hexadecimal color codes into numeric values.

Syntax

=DECIMAL(value, base)
  • value: The text string or number to convert to decimal (e.g., "1010", "FF").
  • base: An integer between 2 and 36 indicating the base of the input value.

Examples

In the table below, Column A holds the source value and Column B holds the base, and Column C uses DECIMAL to convert each value to base 10.

Row A (Value) B (Base) C (Formula) Result Description
1 1010 2 =DECIMAL(A1, B1) 10 Converts binary “1010” to decimal
2 FF 16 =DECIMAL(A2, B2) 255 Converts hexadecimal “FF” to decimal
3 77 8 =DECIMAL(A3, B3) 63 Converts octal “77” to decimal
4 Z 36 =DECIMAL(A4, B4) 35 Converts base-36 “Z” to decimal

Note: When typing a string directly in the formula, wrap it in double quotation marks, such as =DECIMAL("FF", 16).

Common Errors and Tips

  • When #NUM! errors occur
    • Invalid characters for the base: For example, including "2" in a base-2 value or "G" or later in a hexadecimal (base-16) value triggers #NUM!.
    • Base out of range: Specifying a base less than 2 or greater than 36 returns #NUM!.
  • Case sensitivity
    • Letters (A–Z) used in bases 11 and above are case-insensitive ("ff" and "FF" both return 255).
  • Leading zeros disappearing
    • If you type a binary value like 0101 directly into a cell, Google Sheets treats it as a number and drops the leading 0 to 101, though the calculated result is unaffected. To preserve leading zeros as text, type a leading apostrophe ('0101).

Frequently Asked Questions

Q. What range of bases (radixes) does DECIMAL support?

A. You can specify any base from 2 to 36. For bases above 10, the letters A–Z represent values 10–35.

Q. Can I convert a hexadecimal string with a "0x" prefix?

A. No. Including a prefix such as "0xFF" causes a #NUM! error. Remove the prefix and pass only "FF".