DECIMAL function
Converts text representing a number in another base (2–36) into an ordinary decimal number.
Available in Excel 2013 and later, Microsoft 365, Excel for the web, Excel for Mac 2016 and later
Excel 2013 and laterWorks in Google Sheets
Syntax
DECIMAL(text, radix)| Argument | What it means | |
|---|---|---|
text | Required | The digits in the source base, e.g. "FF" or "1010". Up to 255 characters; not case-sensitive. |
radix | Required | The source base, 2 to 36. |
Returns: The decimal value as a number.
How DECIMAL works
DECIMAL is the reverse of BASE: it reads digits written in any base from 2 to 36 and returns the ordinary number. =DECIMAL("FF", 16) is 255 and =DECIMAL("1010", 2) is 10. Use it to decode hex colour codes, binary register values, octal file permissions or base-36 reference codes.
Letters stand for digits above 9 (A = 10 … Z = 35) and case does not matter. Every character must be valid for the base, otherwise the result is #NUM!: "2" is not a binary digit and "G" is not a hex digit. The result must be smaller than 2^53.
Examples
1Decode a hex colour channel
| A | B | C | |
|---|---|---|---|
| 1 | Colour | Hex | |
| 2 | Brand orange | FF8C00 | 140 |
Result: 140
MID takes the green pair 8C, and DECIMAL converts it to 140 (red FF = 255, blue 00 = 0).
2Read a binary value
| A | |
|---|---|
| 1 | 10 |
Result: 10
1×8 + 0×4 + 1×2 + 0×1 = 10.
3Decode a base-36 reference
| A | B | |
|---|---|---|
| 1 | Code | |
| 2 | 21I3V9 | 123456789 |
Result: 123456789
Turns the short code made with BASE back into the order number.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | A character is not valid in the given base, or radix outside 2–36. | Check the text and the radix. |
#VALUE! | Text longer than 255 characters. | Shorten the input. |
Tips
- Strip a leading # or 0x before converting:
=DECIMAL(SUBSTITUTE(A2,"#",""),16).
Google Sheets
DECIMAL also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
DECIMAL in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Dutch | DECIMAAL |
| Finnish | DESIMAALI |
| German | DEZIMAL |
| Hungarian | TIZEDES |
| Italian | DECIMALE |
| Norwegian (Bokmål) | DESIMAL |
| Polish | DZIESIĘTNA |
| Russian | ДЕС |
| Spanish | CONV.DECIMAL |
| Turkish | ONDALIK |