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
2and36indicating 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
2or greater than36returns#NUM!.
- Invalid characters for the base: For example, including
- Case sensitivity
- Letters (A–Z) used in bases 11 and above are case-insensitive (
"ff"and"FF"both return255).
- Letters (A–Z) used in bases 11 and above are case-insensitive (
- Leading zeros disappearing
- If you type a binary value like
0101directly into a cell, Google Sheets treats it as a number and drops the leading0to101, though the calculated result is unaffected. To preserve leading zeros as text, type a leading apostrophe ('0101).
- If you type a binary value like
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".