### Direct Conversion From Any Number Base To Another Base Explained

Let's consider that we need to convert a base 4 number to base 8 number.

Base 4 digits: 0 1 2 3

Base 8 digits: 0 1 2 3 4 5 6 7

We should build a chart to map all digits in base 8 to its equivalent number in base 4. That will come in handy.

So how do we do that? Looks like we need to do conversion from base 8 to base 4 first.

So here are the steps to follow:

- Divide the number to be converted (base 8) by the value of other base (4).
- Get the remainder. That is the least significant digit.
- Divide the quotient with the same value (4).
- Add the remainder as next least significant digit.

We need to convert 4, 5, 6, 7 to its equivalent base 4 number.

For 4:

4 % 4 = 0, 4 / 4 = 1,

1 % 4 = 1, 1 / 4 = 0

So base 4 equivalent of 4 (base 8) is 10

For 5:

5 % 4 = 1, 5 / 4 = 1

1 % 4 = 1, 1 / 4 = 0

So base 4 equivalent of 5 (base 8) is 11

For 6:

6 % 4 = 2, 6 / 4 = 1

1 % 4 = 1, 1 / 4 = 0

So base 4 equivalent of 6 (base 8) is 12

For 7:

7 % 4 = 3, 7 / 4 = 1

1 % 4 = 1, 1 / 4 = 0

So base 4 equivalent of 7 (base 8) is 13

Actually now you have learnt how to directly convert upper base numbers (base 8) to lower base numbers (base 4).

So what's the difference when we convert lower base (base 4) numbers to upper base (base 8)?

Just to remind, we were doing arithmetic operations in base 8 number system. As all digits of base 4 are already present in base 8 number system, we didn't have to do any extra step.

To convert from base 4 to base 8, we will be doing operations in base 4 number system. We need to divide the base 4 number by 8 which is the value of base we are converting to. But 8 is not present in base 4 system. And possible remainders can be 4, 5, 6, 7. So we need to find equivalent values for these numbers in base 4 system.

For 4, 5, 6, 7 we have already done that above.

Let's find equivalent of 8 (base 10) in base 4 system.

8 % 4 = 0, 8 / 4 = 2,

2 % 4 = 2, 2 / 4 = 0

So base 4 equivalent of number 8 (base 10) is 20.

Now we will convert 3211 in base 4 to its equivalent in base 8. Here is the hard part. We need to do the calculation in base 4 system.

Multiplication table:

1 * 20 = 20

2 * 20 = 20 + 20 = 100

3 * 20 = 100 + 20 = 120

__130__________

20 | 3211

20______

121

120______

11

quotient: 130

remainder: 11 (base 8 equivalent is 5)

__3______________

20 | 130

120_____

10

quotient: 3

remainder: 10 (base 8 equivalent is 4)

__0________

20 | 3

quotient: 0

remainder: 3

So in the end we are left with 345. So 3211 in base 4 has been converted to 345 in base 8.

Do note that when we did base 8 to base 4 conversion above, I didn't create multiplication table. That was because I didn't want to confuse you in the beginning. It was handled implicitly as we were converting to higher base & that base was less than 10. But we were actually doing

**arithmetic in base 8 system. So whenever you are doing direct conversion from one number base to another, make sure you have created the proper multiplication table first.**
## Comments

## Post a Comment