Base 16 → base 8
Hex to Octal Converter
Convert hexadecimal to octal — and see why this is the one pair that has no tidy digit-for-digit shortcut.
—
—
Why this conversion is different
Hex to binary is a substitution. Binary to hex is a regrouping. Hex to octal is neither, and the reason is arithmetic: a hex digit is four bits, an octal digit is three, and four does not divide into three or the other way round. There is no fixed number of hex digits that maps onto a whole number of octal digits.
Both bases go through binary cleanly. Expand each hex digit to four bits, re-group the whole bit string into threes from the right, and read each group as an octal digit. Binary is the common ground.
How to convert hex to octal
- Expand every hex digit into its four-bit pattern.
- Join the bits into one continuous string.
- Re-group that string into threes, counting from the right.
- Pad the leftmost group with zeros if it is short.
- Read each group of three as an octal digit from 0 to 7.
Worked example
1A2B to octal
expand 1 A 2 B
0001 1010 0010 1011
join 0001101000101011
regroup from the right, in threes
0 001 101 000 101 011
pad 000 001 101 000 101 011
read 0 1 5 0 5 3
result → 15053 (leading zero dropped)
Digit reference
The mismatch is visible in the table: octal runs out of digits at 7 and needs two positions where hex still has one.
| Hex | Decimal | Binary | Octal |
|---|---|---|---|
| 0 | 0 | 0000 | 0 |
| 1 | 1 | 0001 | 1 |
| 2 | 2 | 0010 | 2 |
| 3 | 3 | 0011 | 3 |
| 4 | 4 | 0100 | 4 |
| 5 | 5 | 0101 | 5 |
| 6 | 6 | 0110 | 6 |
| 7 | 7 | 0111 | 7 |
| 8 | 8 | 1000 | 10 |
| 9 | 9 | 1001 | 11 |
| A | 10 | 1010 | 12 |
| B | 11 | 1011 | 13 |
| C | 12 | 1100 | 14 |
| D | 13 | 1101 | 15 |
| E | 14 | 1110 | 16 |
| F | 15 | 1111 | 17 |
Where octal still turns up
Octal is much rarer than hex today, but it has not disappeared, and where it survives it is usually because three bits map onto something meaningful.
- Unix file permissions.
chmod 755is three octal digits, one per permission group, each holding read, write and execute as three bits. This is the single most common octal encounter. - Older minicomputer architectures. Machines with 12, 18, 24 or 36-bit words divided evenly by three, so octal was the natural shorthand before the byte became universal.
- Numeric literals. A leading zero means octal in C, which has caused a long
history of bugs —
010is eight, not ten. Modern languages prefer an explicit0oprefix for exactly that reason.
Hex won because hardware settled on eight-bit bytes, and eight divides by four but not by three. That argument is set out in full in hex versus octal.
Landmark values
| Hex | Octal | Decimal |
|---|---|---|
| 8 | 10 | 8 |
| F | 17 | 15 |
| 10 | 20 | 16 |
| 1F | 37 | 31 |
| 40 | 100 | 64 |
| 7F | 177 | 127 |
| 80 | 200 | 128 |
| FF | 377 | 255 |
| 100 | 400 | 256 |
| FFFF | 177777 | 65,535 |
FF becoming 377 is the clearest illustration of the mismatch: a value
that fills two hex digits exactly needs three octal digits and still leaves the top one
underused.
Frequently asked questions
How do I convert hex to octal?
Expand each hex digit to four bits, join them, then regroup the bit string into threes from the right and read each group as an octal digit.
Why is there no direct hex to octal shortcut?
A hex digit is four bits and an octal digit is three. Neither divides into the other, so the digits never line up. Binary is the common ground between them.
What is FF in octal?
377. Both represent 255 in decimal.
What is hex 10 in octal?
20. Both represent sixteen.
Where is octal still used?
Most commonly in Unix file permissions, where each of the three digits holds read, write and execute as three bits. It also appears in older architectures with word sizes divisible by three.
Does a leading zero mean octal?
In C and languages that copied it, yes, which is a well-known source of bugs. Modern languages prefer an explicit 0o prefix.