Practice free

OCT2HEX function

OCT2HEX converts an octal number to its hexadecimal equivalent. It is seen in IT, networking and low-level data work, and the input is limited to 10 characters.

Example

Read it as a sentence: convert the octal number 17 to hexadecimal, which gives F.

Practice this in the app

Syntax

OCT2HEX(number, [places])

Arguments in [square brackets] are optional.

number (required)
The octal number to convert, given as text or a number. Up to 10 digits.
places (optional)
Minimum number of characters in the result; pads with leading zeros.

Returns: The hexadecimal equivalent.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=OCT2HEX("17") F Typical
=OCT2HEX("7777777777") FFFFFFFFFF Negative (two's complement)
=OCT2HEX(0) 0 Zero
=OCT2HEX("") 0 Empty string
=OCT2HEX({"1","10"}) 1 Spill
=OCT2HEX(17) F Number input (not text)
=OCT2HEX("8") #NUM! Invalid digit
=OCT2HEX("17777777777") #NUM! Too long input

Watch out for

  • Input is limited to 10 characters.
  • Result is text, not a number.

Where it works

Excel
OCT2HEX is in every version of Excel from 2007 on.
Google Sheets
Same name, same behaviour for everyday use.

Part of Engineering functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .