# How do you convert different bases?

I know how to convert any number into base 10 by using the below method.

Write (6712)base 8 in base 10. Ans: $6 \times 8^3 + 7 \times 8^2 + 1 \times 8^1 + 2 \times 8^0 = 3530_{10}$

However, I am not sure how to convert a number in base 10 or a different base into a number in a different base (other than 10).

For example, write (101)base 2 in base 8.

Is there a formula to solve such questions? Help would be appreciated.

Thank you.

From base $2$ to base $8$ is pretty easy - simply convert each $3$ digits into a single digit as follows:

• $000\rightarrow0$
• $001\rightarrow1$
• $010\rightarrow2$
• $011\rightarrow3$
• $100\rightarrow4$
• $101\rightarrow5$
• $110\rightarrow6$
• $111\rightarrow7$

If the number of digits is not a multiple of $3$, then add $1$ or $2$ leading zeros.

For example: $(011|001|101|001|010)_2=(31512)_8$.

From base $10$ to base $b$, use the following algorithm (shown in an example):

$567382_{10}=?_{8}$

• $567382\div8=70922+\frac{\color\red6}{8}$
• $70922\div8=8865+\frac{\color\red2}{8}$
• $8865\div8=1108+\frac{\color\red1}{8}$
• $1108\div8=138+\frac{\color\red4}{8}$
• $138\div8=17+\frac{\color\red2}{8}$
• $17\div8=2+\frac{\color\red1}{8}$
• $2\div8=0+\frac{\color\red2}{8}$

$567382_{10}=2124126_{8}$

If the initial base is not $10$, then you might have a hard time performing the $\div$ operation.

Since you already know how to convert from any base to base $10$, the general method is:

• Convert from the source base to base $10$ (as you already know)
• Convert from base $10$ to the target base (as shown in the example above)
• I understand that. However, how would we solve it if we were given larger bases to deal? Is there a specific formula? Algorithm? May 30, 2015 at 1:11
• @anonymous: See updated answer. May 30, 2015 at 1:18
• Does that algorithm work for all bases? May 30, 2015 at 1:23
• @anonymous: See updated answer. May 30, 2015 at 1:26
• I have done a some questions from my textbook and am quite confident with it now. Thank you! May 30, 2015 at 1:52