Hexadecimal (Base 16) to Octal (Base 8) Converter
Convert hexadecimal numbers to octal.
FF (base 16) = 377 (base 8)
Digits in base 16: 0 to 9 and A to F. Digits in base 8: 0 to 7.
How to convert Hexadecimal to Octal
Every positional number system works the same way: a digit is worth its own value times the base raised to the power of its position. In base 16 the place values, from the right, are 160 = 1, 161 = 16, 162 = 256 and so on.
Most pairs have no direct trick, so go through decimal, the base we all calculate in. First turn the base 16 number into decimal, then divide by 8 and read the remainders from the bottom up. Two short steps, and you can check the number in the middle.
Both 16 and 8 are powers of 2, so there is a faster way that skips decimal. Write each digit as 4 bits, then regroup the bits in groups of 3 from the right and replace each group with a base 8 digit.
The method
decimal value = each digit × its place value, all added upplace values in base 16: 1, 16, 256, 4096, 65536, and so ondivide by 8, keep the remainder, repeat until the quotient is 0the answer is the remainders read from last to first1 base 16 digit = 4 bits1 base 8 digit = 3 bitsdigits in base 16: 0 to 9 and A to Fdigits in base 8: 0 to 7
Worked example 1: 2D from hexadecimal to octal
Step 1: base 16 to decimal2D (base 16) = 2 × 161 + 13 × 160= 32 + 13= 45Step 2: decimal to base 845 ÷ 8 = 5 remainder 55 ÷ 8 = 0 remainder 5Read the remainders from the bottom up: 552D (base 16) = 55 (base 8)
Letters stand for values from 10 up: A = 10, B = 11, C = 12 and so on. Remainders come out last digit first, which is why you read them from the bottom up. Digits that are 0 add nothing to the sum, so they are left out of the expansion.
Worked example 2: FF from hexadecimal to octal
Step 1: base 16 to decimalFF (base 16) = 15 × 161 + 15 × 160= 240 + 15= 255Step 2: decimal to base 8255 ÷ 8 = 31 remainder 731 ÷ 8 = 3 remainder 73 ÷ 8 = 0 remainder 3Read the remainders from the bottom up: 377FF (base 16) = 377 (base 8)
Worked example 3: 3E8 from hexadecimal to octal
Step 1: base 16 to decimal3E8 (base 16) = 3 × 162 + 14 × 161 + 8 × 160= 768 + 224 + 8= 1,000Step 2: decimal to base 81,000 ÷ 8 = 125 remainder 0125 ÷ 8 = 15 remainder 515 ÷ 8 = 1 remainder 71 ÷ 8 = 0 remainder 1Read the remainders from the bottom up: 17503E8 (base 16) = 1750 (base 8)
Worked example 4: B5 with the bit-group shortcut
B5 (base 16)Write each digit as 4 bits: B = 1011, 5 = 0101Join them and drop leading zeros: 10110101Pad the left with zeros and split into groups of 3: 010 110 101Replace each group with its digit: 010 = 2, 110 = 6, 101 = 5B5 (base 16) = 265 (base 8)
Both bases are powers of 2, so there is no need to go through decimal. Groups of 3 bits make one base 8 digit.
Need the other direction? Open the Octal to Hexadecimal converter.
Hexadecimal to Octal examples
The decimal number 255 is written FF in hexadecimal and 377 in octal.
| Hexadecimal | Octal | Decimal |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 7 | 7 | 7 |
| 8 | 10 | 8 |
| A | 12 | 10 |
| F | 17 | 15 |
| 10 | 20 | 16 |
| 20 | 40 | 32 |
| 40 | 100 | 64 |
| 64 | 144 | 100 |
| FF | 377 | 255 |
| 3E8 | 1750 | 1000 |
Where Hexadecimal to Octal comes up
Hexadecimal (base 16) uses 0 to 9 and A to F, and each hex digit stands for exactly four bits, so one byte is always two hex digits. You see it in web colours like #FF8800, memory addresses, MAC addresses, hash values and byte dumps.
Octal uses the digits 0 to 7, and each octal digit stands for exactly three bits. Unix file permissions such as chmod 755 are written in octal, and it also appears in older machine listings where word sizes divide by three.
Going to a smaller base spreads the same value over more digits, so the result is longer. The number 255 needs 2 digits in hexadecimal and 3 in octal.
Hexadecimal to Octal FAQ
How do I convert hexadecimal to octal?
Convert to decimal first by adding up each digit times its place value, then divide that decimal number by 8 repeatedly and read the remainders from last to first. Because both bases are powers of 2, you can also skip decimal and work with groups of bits.
Which digits does hexadecimal use?
Base 16 uses the digits 0 to 9 and A to F. For example, G is not a valid digit in base 16. Letters are not case sensitive on this converter, and results are shown in capitals.
Will the octal number be longer or shorter?
Longer. Going to a smaller base spreads the same value over more digits, so the result is longer. Roughly 1.33 octal digits for every hexadecimal digit. The number 255 needs 2 digits in hexadecimal and 3 in octal.
Is there a shortcut for hexadecimal to octal?
Yes. Both 16 and 8 are powers of 2, so there is a faster way that skips decimal. Write each digit as 4 bits, then regroup the bits in groups of 3 from the right and replace each group with a base 8 digit.
Can I convert negative numbers or fractions?
The converter handles whole numbers, and a leading minus sign works for negatives. Fractions use a different method, where you repeatedly multiply the fractional part by the new base, and they are not supported here.