BASE Function

Converts a number to text in another base, such as binary or hexadecimal.

Category

Math & Trig

Available in

Excel 2013+, Microsoft 365

Returns

Text

Want to practice BASE in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox

Overview

BASE writes a number in any base from 2 to 36: binary (2), octal (8), hexadecimal (16) and more.

Set a minimum length to pad the result with zeros.

Syntax

=BASE(number, radix, [min_length])

Arguments

ArgumentRequired?What it does
numberYesA whole number zero or above.
radixYesThe base, from 2 to 36.
min_lengthOptionalPad with leading zeros to at least this length.

Examples

Example 1 — Binary flags

Show permission codes as 8-digit binary.

B2fx=BASE(A2, 2, 8)
AB
1CodeBinary
2500000101
31200001100
425511111111
=BASE(A2, 2, 8) Explain

Example 2 — Hex colour part

Convert 255 to hexadecimal.

=BASE(255, 16) Explain

Returns FF.

Common mistakes

  • Text, not a number. The result is text. Use DECIMAL to convert back.

Notes

  • Related functions: DECIMAL, DEC2BIN, DEC2HEX.
Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.