Associated Topics || Dr. Math Home || Search Dr. Math

### Converting any Number Base to Another

```
Date: 05/11/2001 at 10:38:58
From: Trish
Subject: Converting any number base to another

Dear Dr. Math,

This site has been extremely useful; however, I am still having
problems with the concept of number systems and their conversion from
one to another. How can you convert numbers from any base into any
other base?

Q1) Is there a particular technique for the conversion of any number
base into any other base?

In addition to the above I also require information on basic numeric
calculations within a base 5 system.

I have played around with this and think the technique is correct,
except for division; however, I could really use some input.

34021
- 24113
-------
4403 (base 5)

34021
+ 24113
-------
102134 (base 5)

3212
x    2
------
10424 (base 5)
Q2) How do I apply basic calculation of addition, subtraction,
multiplication, and division in base 5?

I would really appreciate the least complex answer you could give.

Hope to hear from you soon. Regards,
Trish
```

```
Date: 05/11/2001 at 14:43:56
From: Doctor TWE
Subject: Re: Converting any number base to another

Hi Trish! Thanks for writing to Dr. Math.

A good place to start learning about different bases is the Dr. Math
Number Bases FAQ at:

http://mathforum.org/dr.math/faq/faq.bases.html

Some good archive entries to look at for how to convert to and from
another base to decimal (base 10) are:

Binary Conversion
http://mathforum.org/dr.math/problems/stirling1.7.98.html

Converting Binary to and From Decimal
http://mathforum.org/dr.math/problems/shroff.6.16.99.html

Converting Bases
http://mathforum.org/dr.math/problems/reinhardt12.21.97.html

Mensa: Numbering for an Alternate World
http://mathforum.org/dr.math/problems/mensanum.html

In order to convert directly from one base to another, you have to be
able to do arithmetic either in the base you are going to, or the base
you are going from. Thus if you want to convert, for example, a value
in base 12 to base 5 directly, you'd have to be comfortable either with
addition and multiplication in base 5, or with subtraction and division
in base 12. Since most people aren't that comfortable with alternate
base arithmetic, I'd recommend doing this in two steps: first convert
from base 12 to base 10 (our familiar decimal system), then convert
from base 10 to base 5. For example, if I wanted to convert 3A7 (base
12) to base 5, I would first convert to decimal:

144   12   1
---   --   -
3     A   7   =      3 * 144 = 432
^           + 10 *  12 = 120
A=10          +  7 *   1 =   7
---
559 (base 10)

Then I'd convert 559 to base 5:

5 ) 559
-----
5 ) 111 r 4
-----
5 ) 22 r 1
----
5 ) 4 r 2
---
0 r 4   =   4214 (base 5)

As for doing arithmetic in other bases, check out:

Adding in Base 9 and Base 5
http://mathforum.org/dr.math/problems/costa10.21.97.html

Binary Subtraction
http://mathforum.org/dr.math/problems/houston.7.25.96.html

Binary Operations
http://mathforum.org/dr.math/problems/matt4.7.97.html

Operations in Nondecimal Bases
http://mathforum.org/dr.math/problems/paley.10.16.99.html

Multiplying and Dividing Computer Style
http://mathforum.org/dr.math/problems/hodsdon9.8.98.html

Long Division in Binary
http://mathforum.org/dr.math/problems/ames1.5.16.00.html

Fraction/Decimal Conversion to Other Bases

If you are still confused or have any further questions, write back.
I hope this helps.

- Doctor TWE, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 06/06/2001 at 11:27:27
From: Trish
Subject: Full Marks on Assignment, Thanks
Thank you so very much for all your help with my questions relating to
base conversion.

With the information Dr. Math provided and the book _A Survey of
Mathematics_, by Vivian Shaw Groza (Holt, Rinehart & Winston, New York,
1968), I managed to complete the assignment and obtain full marks.

Thanks again,
Trish
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search