OCT2HEX Function

OCT2HEX Function

OCT2HEX Function

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.

ExcelClash Team
PUBLISHED

Summary

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.

Purpose

Convert octal to hex

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

Return value

Hex text

Returns text made of 0-9 and A-F.

Syntax

=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.

Arguments

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

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 vs similar functions

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

Using OCT2HEX

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.

Example 1 - Convert 72 to hex

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"
Check Answer
Challenge #1
Target: Sheet1!F1
Basic Octal to Hex Map

Convert Octal "72" to hex. Formula: =OCT2HEX("72").

Example 2 - Pad the result to 4 characters

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"
Check Answer
Challenge #2
Target: Sheet1!F2
Fixed-Length Address Padding

Convert Octal "17" into a 4-digit padded hex string. Formula: =OCT2HEX(17, 4).

Example 3 - Convert a negative octal value

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"
Check Answer
Challenge #3
Target: Sheet1!F3
Signed Negative Octal

Convert -8 (Octal 7777777770) to hex. Formula: =OCT2HEX("7777777770").

Example 4 - Convert 377 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.

=OCT2HEX(377, 2) // Returns "FF"
Check Answer
Challenge #4
Target: Sheet1!F4
Modern Register Mapping

Convert Octal "377" to its 2-digit hex equivalent. Formula: =OCT2HEX(377, 2).

Quick recap

  • Converts octal to hex: OCT2HEX returns base-16 text from a base-8 value.
  • Places pads positive values: Use it for fixed-width hex output.
  • Negative values ignore places: Excel returns a full signed hex 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 OCT2HEX 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.