gettoolz.app

Octal to hex converter

Convert octal numbers to hex — through binary, 3 bits per octal digit regrouped by 4. Exact at any size, with a worked example and a table of common values. Free, and computed in your browser.

Part of developer tools.

Base

Binary

10101101

Octal

255

Decimal

173

Hexadecimal

AD

Octal to hex table

DecimalOctalHex
000
111
222
333
444
555
666
777
8108
9119
1012A
1113B
1214C
1315D
1416E
1517F
162010
10014464
1271777F
255377FF
256400100
100017503E8
10242000400
4096100001000
65535177777FFFF
429496729537777777777FFFFFFFF
184467440737095516151777777777777777777777FFFFFFFFFFFFFFFF

The last rows are the largest 32-bit and 64-bit unsigned values. The second is past the point where ordinary JavaScript numbers start rounding; the table and the converter above both compute with BigInt, so every digit is exact.

How to convert octal to hex

Octal and hex digits do not map onto each other: an octal digit holds 3 bits and a hex digit 4. The reliable route is through binary: expand each octal digit to 3 bits, regroup the bits by 4 from the right, and read each group as one hex digit. For 255: 010 101 101 → 1010 1101 → AD.

Octal and hex side by side

The largest 16-bit value is 177777 in octal and FFFF in hex: 6 digits against 4. Both bases are powers of two, but 3 bits against 4 only line up every 12 bits — 4 octal digits for 3 hex digits — which is why the conversion goes through binary. Hex is the usual way to write bytes — colours like #FF8800, memory addresses, hashes, escape sequences — because a byte is always exactly two hex digits. In JavaScript and Python source, 173 is written 0o255 in octal and 0xAD in hex. Paste a prefixed number into the converter and it switches to the matching base; a number with no prefix is read in the selected base — octal on this page.

Other conversions

Going the other way? Hex to octal converter.

Or open the full number base converter and see a number in all four bases at once.