BASE function
Converts a number into text in another base (radix 2–36), e.g. binary, hexadecimal or base 36.
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
BASE(number, radix, [min_length])| Argument | What it means | |
|---|---|---|
number | Required | A whole number from 0 to 2^53 − 1. |
radix | Required | The target base, 2 to 36 (2 binary, 8 octal, 16 hex, 36 uses 0–9 and A–Z). |
min_length | Optional | Minimum length of the result; it is padded with leading zeros. |
Returns: Text representing the number in the chosen base.
How BASE works
BASE writes a number in any base from 2 to 36. =BASE(255, 16) returns FF and =BASE(10, 2) returns 1010. It is handy for colour codes, binary flags, IT addresses and for turning long numeric IDs into short codes in base 36, which uses all digits and letters.
Unlike the older DEC2BIN and DEC2HEX, BASE handles any radix and much larger numbers (up to 2^53 − 1), but not negative values. The optional min_length pads with zeros, so BASE(10, 2, 8) gives the 8-bit form 00001010. Convert back with DECIMAL.
Examples
1Hex colour code from RGB values
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Colour | Red | Green | Blue | |
| 2 | Brand teal | 0 | 128 | 128 | #008080 |
Result: #008080
Each channel becomes two hex digits (0 → 00, 128 → 80), joined into a web colour code.
2Eight-bit binary flags
| A | |
|---|---|
| 1 | 00001010 |
Result: 00001010
10 in binary is 1010; min_length 8 pads it to a full byte.
3Short code from a long order number
| A | B | |
|---|---|---|
| 1 | Order no. | |
| 2 | 123456789 | 21I3V9 |
Result: 21I3V9
Base 36 squeezes the 9-digit number into 6 characters, useful for short reference codes.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | Number negative or ≥ 2^53, or radix outside 2–36. | Check the inputs. |
#VALUE! | Non-numeric argument. | Check the inputs. |
Tips
- The result is text; use DECIMAL to calculate with it again.
Google Sheets
BASE also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
BASE 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 |
|---|---|
| Danish | BASIS |
| Dutch | BASIS |
| Finnish | PERUS |
| German | BASIS |
| Hungarian | ALAP |
| Norwegian (Bokmål) | GRUNNTALL |
| Polish | PODSTAWA |
| Russian | ОСНОВАНИЕ |
| Swedish | BAS |
| Turkish | TABAN |