Base 8 → base 16
Octal to Hex Converter
Convert octal to hexadecimal by regrouping three-bit digits into four-bit nibbles.
How to convert octal to hex
- Expand each octal digit into its three-bit pattern.
- Join the bits into one continuous string.
- Re-group into fours, counting from the right.
- Pad the leftmost group with zeros if it is short.
- Read each group of four as a hex digit from 0 to F.
Octal digits and their bits
| Octal | Binary | Decimal |
|---|---|---|
| 0 | 000 | 0 |
| 1 | 001 | 1 |
| 2 | 010 | 2 |
| 3 | 011 | 3 |
| 4 | 100 | 4 |
| 5 | 101 | 5 |
| 6 | 110 | 6 |
| 7 | 111 | 7 |
Eight digits, three bits each. Compare that with hex, which needs sixteen digits and four bits, and the reason the two never line up becomes obvious.
Worked example
15053 to hex
expand 1 5 0 5 3
001 101 000 101 011
join 001101000101011
regroup from the right, in fours
001 1010 0010 1011
pad 0001 1010 0010 1011
read 1 A 2 B
result → 1A2B
A worked permissions example
Unix permission modes are the most common octal values people need to translate, and they show why octal is the better notation for that particular job.
chmod 755 7 = 111 owner: read, write, execute 5 = 101 group: read, execute 5 = 101 others: read, execute as bits 111 101 101 as hex 0001 1110 1101 → 1ED
755 is instantly readable as three permission triples. 1ED is the same
number and tells you nothing at a glance. Where the underlying structure is three bits wide, octal
is genuinely the right choice — which is why it survives there and almost nowhere else.
Landmark values
| Octal | Hex | Decimal | Note |
|---|---|---|---|
| 7 | 7 | 7 | Largest single octal digit |
| 10 | 8 | 8 | Octal rolls over three positions early |
| 17 | F | 15 | Largest single hex digit |
| 100 | 40 | 64 | Octal's third position |
| 377 | FF | 255 | One full byte |
| 400 | 100 | 256 | One byte overflowed |
| 777 | 1FF | 511 | Three octal digits full |
| 177777 | FFFF | 65,535 | A full 16-bit word |
Reading octal safely
Two habits prevent most octal mistakes. First, check the prefix: a leading zero means octal in C
and its descendants, so 0755 and 755 can be different numbers depending on
the language. Second, remember that octal has no digits 8 or 9 — if you see one, the value is
not octal, and the converter above will tell you so rather than guess.
Frequently asked questions
How do I convert octal to hex?
Expand each octal digit to three bits, join them, then regroup the bit string into fours from the right and read each group as a hex digit.
What is octal 777 in hex?
1FF. Both represent 511 in decimal.
What is chmod 755 in hex?
1ED. But hex is the wrong notation for permissions, because the underlying fields are three bits wide and octal shows them directly.
Why does octal have no 8 or 9?
Base 8 uses only the digits 0 through 7. A value of eight rolls over to 10 in octal, the same way ten rolls over to 10 in decimal.
Does a leading zero matter?
In C-family languages a leading zero marks an octal literal, so 010 is eight rather than ten. This converter treats your input as octal regardless.
Can I convert octal directly to hex without binary?
Only by going through the value itself. There is no digit-level mapping, because three bits and four bits do not divide into each other.