HEX2OCT Function

Excel 2007+

Summary

The Excel HEX2OCT function converts hexadecimal numbers to their octal (base-8) equivalents. This is essential for number system conversions, particularly when working with binary data representations or legacy systems that use octal notation.

Syntax

HEX2OCT(number, [places])

Parameters

Parameter Type Required Description
number String Yes The hexadecimal number to convert. Max 10 characters, uses two's-complement for negatives.
places Integer No Optional: Number of characters to use in result. Adds leading zeros if needed.

Using the HEX2OCT Function

HEX2OCT is perfect for converting hex values from memory addresses, color codes, or binary data into readable octal format. Use the places parameter to standardize output length for reports or data alignment.

Common HEX2OCT Examples

Basic Hex to Octal Conversion

=HEX2OCT("F", 3)

Converts hex F (15 decimal) to 3-digit octal: 017

Multi-digit Hex Conversion

=HEX2OCT("3B4E")

Converts 3B4E hex (15246 decimal) to octal: 35516

Large Negative Number

=HEX2OCT("FFFFFFFF00")

Converts large hex (negative in two's complement) to 10-digit octal: 7777777400

Frequently Asked Questions

Negative numbers use two's-complement notation. HEX2OCT ignores 'places' and always returns a 10-character octal result.

Maximum 10 hexadecimal characters. Positive ≤ 1FFFFFFF, negative ≥ FFE0000000.

Common Errors and Solutions

#NUM!

Cause: Invalid hex number, exceeds size limits, or requires more characters than places

Solution: Verify hex format, check number range (≤10 chars), increase places if needed

#VALUE!

Cause: Places argument is non-numeric

Solution: Ensure places is a valid number

#NUM!

Cause: Negative places value

Solution: Use only positive integers or omit places

Notes

  • Most significant bit is the sign bit (40-bit total: 1 sign + 39 magnitude)
  • For negative numbers, always returns exactly 10 octal characters
  • Places parameter is truncated to integer if decimal provided

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2003 and earlier

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+