BASE Function

Excel Functions › Math & Trig

Excel 2013+ Math & Trig

The Excel BASE function converts a number into a text representation in a given radix (base), from binary (base 2) all the way up to base 36 — with optional zero-padding to a minimum length.


Quick answer:
=BASE(255, 16) decimal 255 in hex = "FF"

Syntax

=BASE(number, radix, [min_length])
ArgumentDescription
numberRequiredThe number you want to convert. Must be a non-negative integer less than 2^53.
radixRequiredThe base to convert to, an integer from 2 to 36.
min_lengthOptionalMinimum length of the returned text. If the result is shorter, BASE pads it with leading zeros.

How to use it

BASE turns a regular (base 10) number into text written in another base. The radix can be anything from 2 to 36 — digits beyond 9 use the letters A–Z.

=BASE(255, 16) // hex = "FF"
=BASE(8, 2) // binary = "1000"

The optional min_length pads the result with leading zeros — handy for fixed-width fields like byte values or color codes:

=BASE(100, 16, 4) // padded to 4 = "0064"

The result is always text, not a number. To go the other way — reading a base-N string back into a decimal value — use DECIMAL.

Tip: BASE is the general-purpose converter. For the classic computing bases there are dedicated functions too: DEC2BIN, DEC2HEX, and DEC2OCT.

Try it: interactive demo

Live demo

Pick a BASE example to see the formula and its result.

Result:

Practice workbook

📊
Download the free BASE practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What range of bases does BASE support?
Any radix from 2 to 36. Bases above 10 use letters: base 16 (hex) uses 0–9 then A–F, and base 36 uses 0–9 then A–Z.
Does BASE return a number or text?
Text. =BASE(255,16) returns the string "FF", which you can't do arithmetic on directly. Convert it back with DECIMAL if you need a numeric value.
What does the min_length argument do?
It sets a minimum width and pads the result with leading zeros if needed. =BASE(100,16,4) returns "0064" instead of "64". Results longer than min_length are left unchanged.
How is BASE different from DEC2HEX?
BASE handles any base from 2 to 36 and any non-negative size, while DEC2HEX is limited to hexadecimal (and a smaller range, with two's-complement handling of negatives). Use BASE for general conversions.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: DECIMAL · ROMAN · ARABIC · RAND · SEQUENCE