Practice free

BASE function

BASE writes a decimal number in another base, from binary and hexadecimal up to base 36, and returns it as text. It is useful for IDs, flags and checking bit patterns.

Example

Read it as a sentence: convert 255 to base 16, which gives FF.

Practice this in the app

Syntax

BASE(number, radix, [min_length])

Arguments in [square brackets] are optional.

number (required)
A whole number, zero or more.
radix (required)
The base to convert to, from 2 to 36.
min_length (optional)
Pad the result with leading zeros up to this many characters.

Returns: The number written in the new base, as text.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=BASE(255,16) FF 255 base 16
=BASE(255,2,10) 0011111111 255 base 2 min_length 10
=BASE(35,36) Z Base 36
=BASE(2^53-1,36) 2GOSA7PA2GV 2^53-1
=BASE(10.9,2) 1010 Non-integer 10.9
=LEN(BASE(1,2,255)) 255 min_length 255
=BASE(10,37) #NUM! Base 37
=BASE(10,1) #NUM! Base 1

Watch out for

  • The result is text, so leading zeros survive but you cannot add it directly.
  • Negative numbers return #NUM!.

Where it works

Excel
BASE arrived in Excel 2013. Older versions do not have it.
Google Sheets
Same name, same behaviour for everyday use.

Part of Math and trig functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .