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.
Binary
10101101
Octal
255
Decimal
173
Hexadecimal
AD
Octal to hex table
| Decimal | Octal | Hex |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 3 | 3 |
| 4 | 4 | 4 |
| 5 | 5 | 5 |
| 6 | 6 | 6 |
| 7 | 7 | 7 |
| 8 | 10 | 8 |
| 9 | 11 | 9 |
| 10 | 12 | A |
| 11 | 13 | B |
| 12 | 14 | C |
| 13 | 15 | D |
| 14 | 16 | E |
| 15 | 17 | F |
| 16 | 20 | 10 |
| 100 | 144 | 64 |
| 127 | 177 | 7F |
| 255 | 377 | FF |
| 256 | 400 | 100 |
| 1000 | 1750 | 3E8 |
| 1024 | 2000 | 400 |
| 4096 | 10000 | 1000 |
| 65535 | 177777 | FFFF |
| 4294967295 | 37777777777 | FFFFFFFF |
| 18446744073709551615 | 1777777777777777777777 | FFFFFFFFFFFFFFFF |
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.