Excel Base Function

If you just need to excel base function and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =BASE(number, radix) to convert a decimal number into another base, and =DECIMAL(text, radix) to convert it back.

On this page8

Syntax

=BASE(number, radix, [min_length]) and =DECIMAL(text, radix)

Arguments

Argumentrequired / optionalDescription
numberrequiredThe decimal number to convert.
radixrequiredTarget base, 2 to 36 — 2 binary, 16 hexadecimal.
min_lengthoptionalPad the result with leading zeros to this length.

Related functions

CONVERTCHAR and CODEVALUE
▤Annotated stepsExcel
1

Type =BASE( and enter the decimal number.

2

Add a comma and the target base — 2 for binary, 16 for hex, 36 for alphanumeric.

3

Add a minimum length if the result must be a fixed width.

4

Use =DECIMAL(text, radix) with the same base to convert back.

Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

BASE converts a decimal number into any base from 2 to 36, and DECIMAL reverses it. They generalise the older DEC2BIN and HEX2DEC family, which are limited to specific bases and to small ranges — BASE handles far larger numbers and any radix, which makes it the better default. Their real-world uses are narrow but genuine: reading hex colour codes, decoding permission bitmasks, and generating short alphanumeric identifiers by encoding a counter in base 36. The optional min_length pads with leading zeros, which matters for fixed-width identifiers. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. For “excel base function”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected formula change, and only then apply the same setup to the full sheet. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That is what makes a calculation you can defend to a CFO or an auditor useful in real work: repeatable, auditable, and not dependent on memory or luck.

A worked example

A decimal 255 as hexadecimal: =BASE(255, 16) returns "FF". Back again: =DECIMAL("FF", 16) returns 255. An 8-bit binary representation with padding: =BASE(5, 2, 8) returns "00000101". A short ID from a row counter: =BASE(ROW()*7919, 36). BASE and DECIMAL cover every radix conversion in two functions, where the legacy family needed one per base pair and capped out early. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.

In Google Sheets

Google Sheets support for this task has not been verified. Check the function, arguments and workflow in the target product before transferring the example. Matching formula notation does not establish identical behaviour. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. For “excel base function”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.

Common mistakes

  • Expecting BASE to return a number; it returns text, so the result cannot be summed.
  • A radix outside 2 to 36, which returns #NUM!.
  • Reaching for DEC2BIN and friends, which are limited to small ranges where BASE is not.

Frequently asked questions

How do I convert decimal to hex?

=BASE(A2, 16). To go back, =DECIMAL(A2, 16).

What is the difference from DEC2HEX?

BASE handles any base from 2 to 36 and much larger numbers; DEC2HEX is limited to hex and a small range.

How do I pad binary to 8 digits?

Pass the length as the third argument: =BASE(5, 2, 8) returns "00000101".