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

Converting Base Numbers Directly Without Using Base 10

```Date: 01/26/2004 at 01:53:32
From: John
Subject: Bases changes

How do you convert from one base to another without going through base
10?  I understand conversions between binary based bases, but how do I
go from base 3 to base 7, for instance?  Would the same algorithm work
to go from base 5 to base 12?

```

```
Date: 01/26/2004 at 13:14:00
From: Doctor Greenie
Subject: Re: Bases changes

Hi, John --

The process is straightforward and can be used to convert between any
two bases.  But to use it you need to be proficient in the arithmetic
of both the bases you are working with.  The key to the process is the
method you use to evaluate a number in a particular base.

Given the base-10 number "1234", there are two basic ways to evaluate it:

(1)  (using place values)

1*1000 + 2*100 + 3*10 + 4 = 1000 + 200 + 30 + 4 = 1234

(2)  ("building" the number from left to right using only the base)

With this method, you start from the left in the number; for each
digit, you add that digit and then multiply by the base:

1                ["add" the next (first) digit]
1 * 10 = 10      [multiply by the base]
10 + 2 = 12      [add the next digit]
12 * 10 = 120    [multiply by the base]
120 + 3 = 123    [add the next digit]
123 * 10 = 1230  [multiply by the base]
1230 + 4 = 1234  [add the next digit]

I used a base-10 example first so you could see the process; let's use
the two methods to evaluate 1234 (base 5):

(1)  (using place values)

1*125 + 2*25 + 3*5 + 4 = 125 + 50 + 15 + 4 = 194

(2)  ("building" the number from left to right using only the base)

1
1 * 5 = 5
5 + 2 = 7
7 * 5 = 35
35 + 3 = 38
38 * 5 = 190
190 + 4 = 194

You can convert directly between any two bases using the second method
described above--you just need to be able to do the required
arithmetic in the bases you are working with.  Following is a
demonstration of the conversion

1234 (base 5) = ??? (base 7)

We use method (2) above, doing the arithmetic in base 7....

1 * 5 = 5
5 + 2 = 10  (again, you need to know that 7 in base 7 is 10)
10 * 5 = 50
50 + 3 = 53
53 * 5 = 361
361 + 4 = 365

Note that the arithmetic is all in base 7 (the "new" base), while the
multiplication at each stage is by 5 (the "old" base).

Checking this result--by evaluating 1234 (base 5) and 365 (base 7)
using our familiar base-10 arithmetic--we have

1234 (base 5):

1
1 * 5 = 5
5 + 2 = 7
7 * 5 = 35
35 + 3 = 38
38 * 5 = 190
190 + 4 = 194

365 (base 7):

3
3 * 7 = 21
21 + 6 = 27
27 * 7 = 189
189 + 5 = 194

And one more example: following is a demonstration of the conversion

1234 (base 7) = ??? (base 5)

We use method (2) above, doing the arithmetic in base 5.  Note that in
this example the (base 5) arithmetic is complicated by the fact that
our multiplier (the old base, 7) is "12" in base 5....

1
1 * 12 = 12
12 + 2 = 14
14 * 12 = 223
223 + 3 = 231
231 * 12 = 3322
3322 + 4 = 3331

To check this result, we use our familiar base-10 arithmetic to
evaluate both 1234 (base 7) and 3331 (base 5):

1234 (base 7):

1
1 * 7 = 7
7 + 2 = 9
9 * 7 = 63
63 + 3 = 66
66 * 7 = 462
462 + 4 = 466

3331 (base 5):

3
3 * 5 = 15
15 + 3 = 18
18 * 5 = 90
90 + 3 = 93
93 * 5 = 465
465 + 1 = 466

If you followed the preceding examples with pencil and paper, trying
to perform the additions and multiplications in the unfamiliar bases,
you probably had considerable difficulties.  For this reason, when
converting between two unfamiliar bases, it is easier to convert first
from the "old" base to base 10 and then from base 10 to the "new"
base, because all the arithmetic in both those steps can be done in
our familiar base 10.

I hope all this helps.  Please write back if you have any further

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

```
Date: 08/22/2015 at 10:53:38
From: Shweta
Subject: Base Conversion of fractional number(321.42) without base10

Hey,

The post above shows how to convert a number from one base to another
without first converting it to base 10. But I want to know how to convert
a number from one base to another without converting it to base 10 when
there's a decimal point in it.

For example, convert 321.42 (base 6) to base 7.

I know how to convert from base 6 to base 10, and from base 10 to base 7.
But I want to know how to convert the 0.42 (base 6) to base 7, bypassing
the step to convert to base 10.

```

```
Date: 08/22/2015 at 11:39:49
From: Doctor Peterson
Subject: Re: Base Conversion of fractional number(321.42) without base10

Hi, Shweta.

Do you know how to convert fractional numbers between bases? You just do
the same thing you'd do converting either to or from base 10, but do your
arithmetic in the base you are converting to or from. The same will be

Show me how you'd convert 0.42_six to base 10, or 0.43_ten to base 7, and
I'll show you how to adapt that (if you haven't already done it).

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

```

```
Date: 08/22/2015 at 12:15:14
From: Shweta
Subject: Base Conversion of fractional number(321.42) without base10

Yeah, I do know how to convert 0.42(base 6) to base 10, and then base 10
to base 7. First,

0.42 (base 6) to base 10 ->
0.42 (base 6) = 4*6^-1 + 2*6^- 2
= 0.722 (base 10)

From there,

0.722 (base 10) to base 7 ->
0.722*7 = 5.054 -> 5
0.054*7 = 0.378 -> 0
0.378*7 = 2.646 -> 2
0.646*7 = 4.522 -> 4

And so on.

So, 0.42 (base 6) = 0.5024 (base 7).

This is what my teacher taught me.

But I am unable to figure out how to convert from base 6 to base 7
directly.

```

```
Date: 08/22/2015 at 13:02:20
From: Doctor Peterson
Subject: Re: Base Conversion of fractional number(321.42) without base10

Hi, Shweta.

There is a quicker way to convert a fractional number to base 10. I show
several methods for conversions in both directions here:

Fraction/Decimal Conversion to Other Bases
http://mathforum.org/library/drmath/view/55744.html

The best method, I think, is to repeatedly divide by the base, then add in
the next digit, starting at the far end:

0.42_six, to base ten

farthest digit is 2: 2/6 = 0.333...
add next digit and divide again: 4.333.../6 = 0.722...

To use this method (or yours) to convert to base 7, we would need to do
the arithmetic, largely division, in base 7. I'd rather avoid dividing in
any unusual base, because it takes a lot of skill.

Your method for converting FROM base 10 is a good one, and it uses
multiplication, which is easier to do in an unfamiliar base. So I'd use
that method for conversion from base 6 to 7, doing the arithmetic in the
original base, 6.

The method, again, is to multiply by the new base, take the integer part
as a digit in the answer, and repeat using the fraction part that remains.

Let's do it:

0.42_six to base seven, working in base six:

New base, written in base six, is 11_six

0.42_six * 11_six = 5.02 --> 5     0.42_six   0.02_six   0.22_six
* 11       * 11       * 11
0.02_six * 11_six = 0.22 --> 0     ----       ----       ----
42          2         22
0.22_six * 11_six = 2.42 --> 2      42          2         22
----       ----       ----
0.42_six * 11_six = 5.02 --> 5     5.02_six   0.22_six   2.42_six

ten before converting to base seven. (Using a calculator to help with
the work, I wouldn't have rounded anything, but the calculator would
still be limited in its precision.)

I could continue this method for as many places as I want, with no loss
of precision. That's a benefit I'd never thought of in years of advising
students not to bother converting directly!

This could have been a lot more painful, so thanks for offering a problem
in which the multiplications were simple!

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

```

```
Date: 08/22/2015 at 13:36:00
From: Shweta
Subject: Thank you (Base Conversion of fractional number(321.42) without base10)

Thank you, now I get it.

All the other students in my class solved it the other way, converting to
base 10 and back again. But I was just curious to find how to convert it
directly.

Thanks again. You were very helpful.
```

```Date: 10/13/2015 at 08:33:13
From: durga
Subject: converting a fraction from lower base to higher base

I saw the process, above, of converting a fraction from one base to
another. In it, the fraction was repeatedly multiplied with the new base
with respect to old base.

I want to convert 0.3 in base 4 to base 7. But if the multiplication
is done in the old base (multiplied with 7, which is 13 in base 4), then
the process suggests an answer in base 4, rather than in base 7.

Multiplication in the original base will result in an answer in that same
base. There is no problem while converting from higher to lower base in
this process, but how do we express the answer in the new, higher base?

To continue my example, I will convert 0.3 in base 4 to base 7.

7 is 13 in base 4. Multiplying 0.3 and 13 in base 4 is 21.3.

And that's where I am stuck.
```

```Date: 10/13/2015 at 09:36:58
From: Doctor Peterson
Subject: Re: converting a fraction from lower base to higher base

Hi, Durga.

I don't see how what you want to do is different from the original
suggestion.

In both cases, the conversion is from a lower base to a higher
one -- and even that, in principal, should not matter. The important
thing, which perhaps was not shown in the example, is that the digit
you get, in the old base, must be converted to the new base. (My
illustration of that appears farther below.)

> 7 is 13 in base 4. Multiplying 0.3 and 13 in base 4 is 21.3.
>
> And that's where I am stuck.

What is the next step in the process? You now take the integer part of
the result you got, 21 (base 4), and use that as a digit in the answer.

Since 21 (base 4) = 9, however, this can't be a digit, so something is
wrong. Let's check your multiplication, since a number less than 1
multiplied by 7 can't be greater than 7:

0.3
* 1 3 (base 4)
-----
2 1
3
-----
1 1.1   (yes, you were wrong)

That tells me that the first digit will be 11 (base 4) = 5. That makes
more sense. (Can you see how you multiplied wrong? and how you obtain a
base-7 digit from a base-4 result?) Now you continue with 0.1 multiplied
by 13, ...

On the other hand, maybe you don't have to use this method.

You might find it easier just to write the number as a fraction and
convert by dividing in the new base. For example, 0.3 (base 4) means
3/10 (base 4) which is 3/4. You can put that in base 7 by dividing 3 by
4 in base 7:

.5 1
-------
4 ) 3.0 0  (base 7)
2 6
---
1 0
4
---
...

I would do this with the help of a multiplication table, which I build

4*1 =  4 (base 7)
4*2 = 11
4*3 = 15
4*4 = 22
4*5 = 26
4*6 = 33
4*7 = 40, as expected -- a useful check

Alternatively, and probably easier, you can go through base 10. Just
think of 3/4 as a fraction in base 10, and convert to base 7 using the
same method you are trying to use, but this time multiplying in base 10
and using fractions rather than decimals to avoid rounding:

3/4 * 7 = 21/4 = 5 1/4  --> digit 5
1/4 * 7 = 7/4  = 1 3/4  --> digit 1
...

This could also be done using decimals on a calculator, if you don't
mind a limitation on how far you can go.

- Doctor Peterson, The Math Forum

```

```Date: 10/13/2015 at 09:45:41
From: durga
Subject: Thank you (converting a fraction from lower base to higher base)

I thought we should take only one digit from the integer part in the
process. Taking the integer in the same base and converting to the newer
base is the point I missed.

I have not been able to figure out this for more than a month. Your
answer, explanation, and speed of responding is really awesome.

Thanks a lot.
```
Associated Topics:
High School Number Theory