OCT2HEX Function

Excel Functions › Engineering

All versions Engineering

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


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

Syntax

=OCT2HEX(number, [places])
ArgumentDescription
numberRequiredThe octal 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

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

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

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 octal value and watch it convert to hexadecimal.

Result:

Practice workbook

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