DECIMAL converts a text string written in a given base (radix) into a standard decimal number. It is the reverse of the BASE function and is ideal for reading binary, octal, hexadecimal or custom-base codes as numbers.
=DECIMAL(text, radix)What does DECIMAL do?
DECIMAL is a Math & trigonometry function that turns text written in a number system other than base 10 into a normal number Excel can calculate with. You give it two things: the text to convert and the radix (the base of that number system). For example, =DECIMAL("1010",2) reads the binary text 1010 and returns 10.
This matters because Excel stores and calculates numbers in base 10. Codes such as binary flags, hexadecimal colour values, octal permissions or custom reference numbers arrive as text, and without conversion you cannot add, compare or chart them. DECIMAL bridges that gap in one step and pairs naturally with BASE, which does the opposite.
A typical situation: an IT team exports device status flags as binary strings, and you need to count how many devices have a particular bit set. Instead of decoding by hand, you wrap each flag in DECIMAL and then use ordinary arithmetic or COUNTIF on the results.
When to use DECIMAL
- Converting binary status flags or bitmasks into numbers for counting and filtering.
- Reading hexadecimal colour codes or memory addresses as decimal values.
- Interpreting octal file-permission codes from a system export.
- Decoding custom-base reference numbers such as base-36 product codes.
- Checking student work in computer science or digital electronics courses.
- Preparing imported machine or sensor data for standard Excel calculations.
DECIMAL syntax
=DECIMAL(text, radix)| Argument | Required? | What to enter |
|---|---|---|
text | Required | The text string to convert, written in the source base. It must be supplied as text or a value Excel can read as text, and it cannot contain spaces or invalid digits. Example: "1111" or a cell such as A2. |
radix | Required | The base of the number system in text. Must be an integer from 2 to 36. Base 2 is binary, 8 octal, 10 decimal, 16 hexadecimal, and 36 uses digits 0–9 and letters A–Z. Example: 2 for binary. |
What it returns: DECIMAL returns a decimal number (base 10) equal to the value of the text in the specified base. The result is a numeric value, so it can be used directly in further calculations.
DECIMAL examples
1 Convert a binary string to a number
The goal is to read a simple binary value as a normal number. Cell B2 holds the text "1010", which in base 2 means 8 + 0 + 2 + 0. The formula =DECIMAL(B2,2) tells Excel to treat the text as binary and convert it. It returns 10, the decimal equivalent.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Label | Binary | |||
| 2 | Flag A | 1010 | 10 | ||
| 3 | Flag B | 1111 | |||
| 4 | Flag C | 100000 | |||
| 5 |
2 Convert hexadecimal colour codes
A design export lists colour values as hexadecimal text. The goal is to turn the red channel "FF" into a decimal number. In base 16, F equals 15, so FF is 15 × 16 + 15. The formula =DECIMAL(B2,16) performs that conversion and returns 255, the maximum value of an 8-bit colour channel.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Colour | Hex channel | |||
| 2 | Red | FF | 255 | ||
| 3 | Green | 80 | |||
| 4 | Blue | 1A | |||
| 5 |
3 Decode octal permission codes
A server report shows file permissions in octal, such as "755". The goal is to convert that text into the decimal number used elsewhere in the report. Each octal digit is a power of 8: 7 × 64 + 5 × 8 + 5. The formula =DECIMAL(B2,8) returns 493, which is the decimal form of octal 755.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | File | Octal permission | |||
| 2 | index.html | 644 | 420 | ||
| 3 | app.js | 755 | |||
| 4 | config.ini | 600 | |||
| 5 |
4 Convert base-36 product codes
Product codes use base 36, where letters A–Z stand for values 10–35. The goal is to turn the code "A1" into a sortable number. In base 36, A is 10, so A1 equals 10 × 36 + 1. The formula =DECIMAL(B2,36) returns 361.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Product | Base-36 code | |||
| 2 | Widget | A1 | 361 | ||
| 3 | Gadget | Z9 | |||
| 4 | Gizmo | 10 | |||
| 5 |
5 Count devices with a binary status flag
An IT export lists device status flags as binary text. The goal is to count how many devices have the flag set to binary "1". The formula =DECIMAL(B2,2) converts the first flag to 1, and the same pattern applies down the column. You can then use =COUNTIF(C2:C5,1) on the converted values to get the total, which is 2.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Device | Status flag | |||
| 2 | Printer 01 | 1 | 1 | ||
| 3 | Printer 02 | 0 | |||
| 4 | Scanner 01 | 1 | |||
| 5 | Scanner 02 | 0 | |||
| 6 |
Common DECIMAL errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #NUM! | The radix is outside the allowed range of 2 to 36, for example 1 or 37. | Use a radix between 2 and 36. Check that the base matches the number system in the text. |
| #VALUE! | The text contains characters that are not valid digits for the given radix, such as "2" in binary or a space. | Remove spaces and confirm every character is valid for the base. For base 2 only 0 and 1 are allowed. |
| #VALUE! | The text argument is longer than 255 characters. | Shorten the string or split it into smaller parts before converting. |
| #NAME? | The function name is misspelled or the workbook uses an Excel version that does not include DECIMAL (Excel 2013 and later). | Check the spelling DECIMAL and update Excel if needed. |
Tips for using DECIMAL
- Wrap text values in quotes when typing them directly, for example
=DECIMAL("FF",16). - Use BASE to go the other way: convert a decimal number back into text in another base.
- Keep the radix in its own cell so you can change the base without editing the formula.
- Remember that DECIMAL returns a number, so you can apply SUM, COUNTIF or arithmetic to the results.
- If imported text contains spaces, clean it first with TRIM or SUBSTITUTE before converting.
Frequently asked questions
What is the difference between DECIMAL and BASE?
DECIMAL converts text in any base into a decimal number. BASE does the reverse: it converts a decimal number into text in a chosen base.
Can DECIMAL handle hexadecimal letters?
Yes. With radix 16, the letters A–F are accepted. For radix 36, all letters A–Z are valid.
Why does DECIMAL return #VALUE! for my binary text?
The text probably contains a character other than 0 or 1, or a space. Check the source cell and remove invalid characters.
Is DECIMAL available in all Excel versions?
DECIMAL was introduced in Excel 2013. Older versions do not have it and will show #NAME?.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. DECIMAL reference