HEX2OCT Function

Excel Functions › Engineering

All versions Engineering

The Excel HEX2OCT function converts a hexadecimal (base-16) number to octal (base-8) — a staple for digital electronics, low-level programming, and bit manipulation.


Quick answer:
=HEX2OCT("2A") // 2A (hexadecimal) = 52 (octal)

Syntax

=HEX2OCT(number, [places])
ArgumentDescription
numberRequiredThe hexadecimal number to convert, as text or a value.
placesOptionalPad the result to this many characters with leading zeros (useful for fixed-width output).

How to use it

HEX2OCT converts a hexadecimal (base-16) value to octal (base-8). The result is returned as text, so pad it with the optional places argument for fixed-width displays.

=HEX2OCT("2A") // 2A (hexadecimal) = 52 (octal)

Round-trip tip: every conversion has an inverse — pair this with the reverse function to validate. All base functions cap inputs at 10 characters (signed), so very large numbers need a different approach.

Try it: interactive demo

Live demo

Type a hexadecimal value and watch it convert to octal.

Result:

Practice workbook

📊
Download the free HEX2OCT 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

Why is the HEX2OCT result text, not a number?
Base conversions (except to decimal) return text so leading zeros and hex letters are preserved. Wrap in VALUE or the reverse function if you need a number.
What is the places argument for?
It pads the result with leading zeros to a fixed width — e.g. DEC2BIN(5,8) gives 00000101. Handy for byte-aligned output.
Why do I get #NUM!?
The input isn’t a valid hexadecimal value (wrong digits), or it exceeds the 10-character signed limit of the base functions.
How do negative numbers work?
The base functions use two’s-complement notation within their 10-digit limit; the top digit signals the sign.

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: DEC2BIN · BIN2DEC · DEC2HEX · HEX2DEC