
Convert octal values to hexadecimal text in Excel. Useful when you need to move data from a base-8 format into a base-16 format.
OCT2HEX converts octal text into hexadecimal text. If a value starts in base 8 and needs to end up in base 16, this function gives you that translation directly.
This is useful when you move between older octal-based formats and more common hex-based technical formats. Instead of converting the value in several steps, you can go straight from octal to hex in one formula.
Turns a base-8 value into base-16 text.
Returns text made of 0-9 and A-F.
=OCT2HEX(number, [places])
number is the octal value to convert. places is optional and pads positive results with leading zeros.
The result is hexadecimal text, so this function is mainly for format translation between two technical bases. Add places when the hex output should have a fixed width. If you leave it out, Excel returns the shortest positive hex result it can.
number must be a valid octal input. places is optional and is only used for positive output. It is helpful when a code or exported value has to line up to a certain width. If the converted result is too long for the places value, Excel returns #NUM!.
OCT2HEX is the right choice when the result needs to stay in hexadecimal text form:
| Function | What it does | Typical use | Result |
|---|---|---|---|
OCT2HEX |
Converts octal to hex | Move base-8 values into base-16 form | Hex text |
OCT2DEC |
Converts octal to decimal | Get a number for math | Number |
OCT2BIN |
Converts octal to binary | Inspect bits | Binary text |
HEX2OCT |
Converts hex to octal | Go in the opposite direction | Octal text |
The main use is direct translation between two technical number systems. If one part of your workflow still uses octal and another expects hex, OCT2HEX helps you move the value across without manual conversion.
The places argument can pad positive results with leading zeros. That matters when the output should match a fixed-width field, code, or display format. If the converted result is longer than the places value, Excel returns #NUM!.
Signed negative values behave differently. Excel ignores places for negative input and returns a full signed hexadecimal result, which is why OCT2HEX("7777777770") returns FFFFFFFFF8.
This example shows the direct translation from base 8 to base 16 without going through a manual intermediate step. The octal value 72 becomes the hex value 3A, which is useful when different parts of a workflow use different technical numbering systems.
=OCT2HEX("72") // Returns "3A"
Convert Octal "72" to hex. Formula: =OCT2HEX("72").
The places argument is useful when the hex output has to fit a specific field size. Here the converted value is padded to 000F, which keeps the result aligned with other fixed-width addresses or code values in the same report.
=OCT2HEX(17, 4) // Returns "000F"
Convert Octal "17" into a 4-digit padded hex string. Formula: =OCT2HEX(17, 4).
This example shows how Excel preserves signed engineering-format meaning across base conversions. The octal input represents a negative value, so OCT2HEX returns the full signed hexadecimal result FFFFFFFFF8 rather than a short positive code.
=OCT2HEX("7777777770") // Returns "FFFFFFFFF8"
Convert -8 (Octal 7777777770) to hex. Formula: =OCT2HEX("7777777770").
The octal value 377 becomes FF, which is a useful example because it lands on a familiar two-digit hex byte. This kind of conversion comes up when an older octal-oriented source has to feed a newer hex-oriented destination format.
=OCT2HEX(377, 2) // Returns "FF"
Convert Octal "377" to its 2-digit hex equivalent. Formula: =OCT2HEX(377, 2).
Tell your friends about this post