
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.
OCT2HEX is useful because it connects two technical formats that are both compact, but used in different contexts. It lets the workbook translate an octal value directly into hexadecimal text, which is often easier to match with modern technical references, memory-style values, or code-oriented outputs.
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.
It is a helpful example because it shows that Excel can bridge two compact number formats directly. You do not need helper steps if the sheet simply needs the value rewritten in hex.
=OCT2HEX("72") // Returns "3A"
Convert Octal "72" to hex.
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.
This is useful when the destination format expects a certain length. The example shows that the value itself stays the same, but the output becomes easier to line up with other hex fields.
=OCT2HEX(17, 4) // Returns "000F"
Convert Octal "17" into a 4-digit padded hex string.
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.
That makes the example important for interpretation, not just conversion. It reminds the learner that signed technical values keep their signed meaning when they move from octal to hex.
=OCT2HEX("7777777770") // Returns "FFFFFFFFF8"
Convert -8 (Octal 7777777770) to hex.
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.
It also gives the learner an easy point of reference, because FF is a common hex value. That makes the relationship between the octal code and the final hex output easier to remember.
=OCT2HEX(377, 2) // Returns "FF"
Convert Octal "377" to its 2-digit hex equivalent.
OCT2HEX is most useful when the job is translation, not calculation. In this lesson, the important idea was that Excel can take a value written in base 8 and rewrite it directly as hexadecimal text, which is helpful when one system stores technical values in octal but another system expects them in hex.
The main thing to remember is that the result is text and that the optional places argument only helps with positive values. If you need a fixed-width hex code, places can pad the result with leading zeros, but signed negative engineering values follow Excel's own signed output rules instead.
Tell your friends about this post