
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.
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.
Turns a base-16 value into base-8 text.
Returns a string made of digits 0 through 7.
=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.
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 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 |
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.
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"
Convert Hex "3A" to octal. Formula: =HEX2OCT("3A").
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"
Convert Hex "1ED" to a 3-digit padded octal (755). Formula: =HEX2OCT("1ED", 3).
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"
Convert -1 (Hex FFFFFFFFFF) to 10-character octal. Formula: =HEX2OCT("FFFFFFFFFF").
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"
Convert Hex "FF" to a 4-digit octal offset. Formula: =HEX2OCT("FF", 4).
Tell your friends about this post