Text

BASE Formula

BASE converts a decimal (base 10) number to a text string in another base, such as binary (base 2), octal (base 8), or hexadecimal (base 16). It is useful for programmers, engineers, and anyone working with number systems or encoding schemes.

Syntax

BASE(number, radix, [min_length])
ParameterDescription
number Parameter of the BASE function.
radix Parameter of the BASE function.
[min_length] (Optional.) Parameter of the BASE function.
Try BASE in Viztab — free, no signup

Examples

Decimal to hexadecimal

Formula
=BASE(255, 16)
Returns "FF" — the hexadecimal representation of 255. Useful for color codes, memory addresses, etc.

Decimal to binary with padding

Formula
=BASE(10, 2, 8)
Returns "00001010" — binary representation of 10, padded to 8 digits with leading zeros for consistent byte-width display.

Decimal to octal

Formula
=BASE(255, 8)
Returns "377" — the octal representation of 255.

Common Errors

#NUM!

Occurs when the number is negative, the radix is outside 2-36, or the minimum length is negative.

#VALUE!

Occurs when arguments are non-numeric text.

Tips

Radix range is 2-36

BASE supports any base from 2 (binary) to 36 (using 0-9 and A-Z). Base 16 (hex) and base 2 (binary) are the most common uses.

Pad with leading zeros

The third argument sets minimum output length. =BASE(5, 2, 8) returns "00000101" instead of "101" — essential for consistent formatting.

Result is text

BASE returns a text string, not a number. To convert back, use DECIMAL: =DECIMAL("FF", 16) returns 255.

Try BASE in Viztab

Import your data and use BASE with 370+ other formulas. No signup required.

Open Viztab

Related Formulas