# How to convert from Base 8 to Base 16 (using binary)

## Let's get to it!

Converting from octal (base 8) to hexadecimal (base 16) may seem like a complicated process but it is actually really simple if you know this technique. This is a common technique which utilizes binary (base 2) to convert between octal and hexadecimal.

Let's use an octal number as an example, say: 6453. Now lets convert it using the binary technique (I will give you this example and then explain it).

- Convert 6453(octal) to binary
- You convert from left to right so 6 in octal is 110 in binary
- You go down the line and add each set to the binary number
- 4(octal) = 100(binary) tag this onto 110 and you get 110100
- Repeat and you will end up with 110100101011
- Then you take every 4 digits (starting from the left) and convert back into Hexadecimal
- So 1011 is the first 4 digits, this comes to B in hexadecimal
- If you repeat then you will get D2B as your answer!

So I'm assuming that you're probably wondering how the heck this works or even how the heck you get it to work. Well, here comes the explanation!!!

## The Explanation

First off if you think about the different bases think about binary, binary numbers are either 1 or 0. So it can be represented in one bit (a bit is a 1 or a 0). Now think about an octal number, an octal number can be represented in 3 bits (111 is 7, and 000 is 0). This is because 8 (octal) is 2^3. So what about hexadecimal (base 16). 16 is 2^4 so hexadecimal numbers can be represented by 4 bits (1111 is 15 or F, 0000 is 0). So what if you convert a number to binary you can get the octal or hexadecimal numbers from it by taking 3 or 4 bits starting from the left.

Here's another example, if we took the number F (hexadecimal) and convert it to binary: 1111. Now lets convert it to octal, take the first 3 digits: 111 and convert that to an octal number. This would become 7. Now take the next 3 digit (notice that there is only more digit so just add zeroes until it becomes 3 digits). The next 3 digits are 001 which becomes 1 in octal. Now we put that together and F (hexadecimal) becomes 17 (octal).

Here's another example:

- Convert 67123 (octal) to hexadecimal.
- First lets convert to binary 6-7-1-2-3 becomes 110-111-001-010-011
- Then lets put the binary together: 110111001010011
- Now lets break up the binary into groups of 4, starting from the left: 110-1110-0101-0011
- Now lets convert the binary into hexadecimal: 6E53
- And there you go!!!

Now, here's a quiz to see if you understand this, if you do not then please leave a comment below and I will answer your question!

## Questions?

Please leave any questions you have below! I will edit this hub based on reader's concerns.