HEX2OCT Function

HEX2OCT Function

HEX2OCT Function

Convert hexadecimal values to octal text in Excel. Useful when you need to move data from a base-16 format into a base-8 format.

ExcelClash Team
PUBLISHED

Summary

HEX2OCT converts hexadecimal text into octal text. If a value starts in base 16 and needs to end up in base 8, this function does that translation for you.

That is not as common as decimal conversion, but it is still useful when you move data between systems that use different number formats. In those cases, HEX2OCT saves you from converting through intermediate steps by hand.

Purpose

Convert hex to octal

Turns a base-16 value into base-8 text.

Return value

Octal text

Returns a string made of digits 0 through 7.

Syntax

=HEX2OCT(number, [places])

number is the hex value to convert. places is optional and pads positive results with leading zeros.

The result stays in text form because the goal here is format conversion, not arithmetic. Use places when the octal output should match a set width. If you leave it out, Excel returns the shortest positive octal result it can.

Arguments

  • number - [required] The hexadecimal value to convert. Excel accepts up to 10 characters.
  • [places] - [optional] The minimum number of octal characters to return for positive values.

number must be a valid hexadecimal input. places is optional and mainly useful for fixed-width output. It affects positive results only. If the converted octal value is longer than the places value, Excel returns #NUM!.

HEX2OCT vs similar functions

HEX2OCT is the right choice when the destination format needs to stay in octal text:

Function What it does Typical use Result
HEX2OCT Converts hex to octal Move base-16 values into base-8 form Octal text
HEX2DEC Converts hex to decimal Get a number for math Number
HEX2BIN Converts hex to binary Inspect bits Binary text
OCT2HEX Converts octal to hex Go in the opposite direction Hex text

Using HEX2OCT

The main use is direct translation between two technical number systems. If one system gives you hex and another expects octal, HEX2OCT helps you move between them without first converting the value manually.

The places argument can pad positive results with leading zeros. That matters when the output needs to match a fixed display width or a code format. If the converted result is longer than the places value, Excel returns #NUM!.

Signed negative values work differently. Excel ignores places for negative input and returns a full signed octal result, which is why HEX2OCT("FFFFFFFFFF") gives a 10-character octal string instead of a short one.

Example 1 - Convert 3A to octal

This is the direct hex-to-octal conversion pattern. Excel takes the compact hex value 3A and returns the octal equivalent 72. That is helpful when data has to move into a base-8 format without first being rewritten manually in decimal.

=HEX2OCT("3A") // Returns "72"
Check Answer
Challenge #1
Target: Sheet1!F1
Basic Hex to Octal Map

Convert Hex "3A" to octal. Formula: =HEX2OCT("3A").

Example 2 - Pad the result to 3 characters

Padding matters when the output is expected to match a fixed-width octal code such as a permission-style value. Here, 1ED becomes 755, and the width keeps the result in the conventional form normally used for that kind of code.

=HEX2OCT("1ED", 3) // Returns "755"
Check Answer
Challenge #2
Target: Sheet1!F2
Unix Permission Padding

Convert Hex "1ED" to a 3-digit padded octal (755). Formula: =HEX2OCT("1ED", 3).

Example 3 - Convert a negative hex value

This example shows the signed engineering-format behavior during conversion. The hex input represents -1, so HEX2OCT returns the full signed octal form 7777777777 rather than a short unsigned result.

=HEX2OCT("FFFFFFFFFF") // Returns "7777777777"
Check Answer
Challenge #3
Target: Sheet1!F3
Negative Signed Hex Map

Convert -1 (Hex FFFFFFFFFF) to 10-character octal. Formula: =HEX2OCT("FFFFFFFFFF").

Example 4 - Pad FF as a 4-character octal value

The value FF becomes 0377, which is the same octal value but in a fixed-width form. That is useful when the worksheet needs column-aligned codes or outputs that must follow an exact field layout.

=HEX2OCT("FF", 4) // Returns "0377"
Check Answer
Challenge #4
Target: Sheet1!F4
Legacy Mainframe Address

Convert Hex "FF" to a 4-digit octal offset. Formula: =HEX2OCT("FF", 4).

Quick recap

  • Converts hex to octal: HEX2OCT returns base-8 text from a base-16 value.
  • Places pads positive values: Use it for fixed-width octal output.
  • Negative values ignore places: Excel returns a full signed octal result.
  • Returns text: This is a formatting and translation function, not a numeric math function.
  • Useful for cross-format work: It helps when two systems use different technical bases.
Tactical Arena
Select Scenario:
Share HEX2OCT Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.