☖ Home Units Converter Geometry Σ Math Physics Electricity

Addition of Numbers in Different Bases

Print addition calculator
Allowed values:
Input Base:

NOTE: Choose required input base from 2 to 36 maximum value.

Input Numbers

N1
N2
N3
N4
N5
N6
N7
N8
N9
N10
+
+
+
+
+
+
+
+
+
Change input
values to
input base
Result
Base 2
Base 10
Base 16
Any base

Addition of Numbers in Different Bases

Print addition of numbers

For developing the technic for addition in any base, we will first analyse the well-known addition process of base 10. For that purpose, we will add two numbers in base 10. N110 = 6091, and N210 = 7234.

1 0 1 0 0 ← Carry in
N110 = 6 0 9 1
N210 = 7 2 3 4
N110 + N210 = 1 3 3 2 5

We can describe the complete calculation process in the following table:

Step # Operation Sum Result Carry out
1 0 + 1 + 4 5 5 0
2 0 + 9 + 3 12 12 − 10 = 2 1
3 1 + 0 + 2 3 3 0
4 0 + 6 + 7 13 13 − 10 = 3 1
5 1 + 0 + 0 1 1 0


The same process is performed on the addition of any base for example, add the numbers N16 = 4254  and  N26 = 1430  both of base  6.

1 1 1 0 0 ← Carry in
N16 = 4 2 5 4
N26 = 1 4 3 0
N16 + N26 = 1 0 1 2 4
Step # Operation Sum Result Carry out
1 0 + 4 + 0 4 4 0
2 0 + 5 + 3 8 8 − 6 = 2 1
3 1 + 2 + 4 7 7 − 6 = 1 1
4 1 + 4 + 1 6 6 − 6 = 0 1
5 1 + 0 + 0 1 1 0

Again, the same process is performed on the addition of base 16 (Hexadecimal) for example, add the numbers N116 = AB05 and N216 = 587C both of base 16

1 1 0 1 0 ← Carry in
N116 = A B 0 5
N216 = 5 8 7 C
N116 + N216 = 1 0 3 8 1
Step # Operation Sum Result Carry out
1 0 + 5 + C 17 17 − 16 = 1 1
2 1 + 0 + 7 8 8 0
3 0 + B + 8 19 19 − 16 = 3 1
4 1 + A + 5 16 16 − 16 = 0 1
5 1 + 0 + 0 1 1 0

And the last example is for numbers base 2 (Binary), for example, add the numbers N12 = 1011 and N22 = 1110,  (see 4 bits adder logical circuit, describing the use of the carry).

1 1 1 0 0 ← Carry in
N12 = 1 0 1 1
N22 = 1 1 1 0
N12 + N22 = 1 1 0 0 1
Step # Operation Sum Result Carry out
1 0 + 1 + 0 1 1 0
2 0 + 1 + 1 2 2 − 2 = 0 1
3 1 + 0 + 1 2 2 − 2 = 0 1
4 1 + 1 + 1 3 3 − 2 = 1 1
5 1 + 0 + 0 1 1 0

Summary of operations on two bits

Print summary
Addition
Operation Result Carry
1 + 1 0 1
1 + 0 1 0
0 + 1 1 0
0 + 0 0 0
1 + 1 + 1 1 1
Subtraction
Operation Result Borrow
1 − 1 0 0
1 − 0 1 0
0 − 1 1 1
0 − 0 0 0
Multiplication
Operation Result Carry
1 × 1 1 0
1 × 0 0 0
0 × 1 0 0
0 × 0 0 0
1 × 1 × 1 1 1

General method to describe the addition values of numbers are:

Each addition value is:(N1 + N2) % Base
And the carry value is:(N1 + N2 + C) \ Base
Notes: C - is the previous carry, first carry is 0
(%) is the remainder operator of the division.
(\) is the integer division.
This process should be applied on all the pairs digits of both numbers.

Any decimal number can be expressed in powers of any base, multiplied by a coefficient as

follows: (B is the required base):             N10 = ... + eB4 + dB3 + cB2 + bB1 + aB0

And the number in the new base is:        NB = edcba

For example: the decimal number 1235 in base 16 it will be:

(1235)10 = 4 · 162 + 13 · 161 + 3 · 160 = (4D3)16

In this example c = 4     b = 13 = D     a = 3    and the number in base 16 (hexadecimal) is 4D3

Try the same number but now in base 8:
We check first, which power of 8 is bigger than the given number, and we have 84 = 4096 so the biggest possible power is 3

(1235)10 = 2 · 83 + 3 · 82 + 2 · 81 + 3 · 80 = (2323)8

Subtraction of Numbers in Different Bases

Print subtraction of numbers

Let check the subtraction of numbers of base 10, where N1 = 7103 and N2 = 6932 than to find the value N1 − N2 we do the following steps.

-1 10 10 0 ← Borrow
N110 = 7 1 0 3
N210 = 6 9 3 2
N110 − N210 = 0 1 7 1

Step Description
1 calculate   3 − 2 = 1
2 Because 0 is less than   3   we borrow from the next level   10, and get 10 + 0 − 3 = 7
3 Because we borrowed  1, we have to reduce it from 1 so we have 1 − 1 = 0 and because 0 is less than 9 we have to borrow again from the next level so we have, 10 + 1 − 1 − 9 = 1.
4 Because we borrowed 1, we have 7 − 1 − 6 = 0.
And the final value is:  171.

Find the subtraction of the numbers N116 = C25D minus N216 = 48AB in hexadecimal base.
We perform the following steps.

-1 16 16 0 ← Borrow
N116 = C 2 5 D
N216 = 4 8 A B
N116 − N216 = 7 9 B 2

Step Description
1 calculate   D − B   is equivalent to 13 − 11 = 2
2 Calculate  5 − A,   because 5 is less than   A   we borrow from the next level   16,  and get 16 + 5 − A = B,  (A is equal to 10)
3 Calculate  2 − 8,   but because we borrowed   1 in the previous step we have to reduce 1 so, 2 − 1 = 1, and because 1 is less than 8 we have to borrow 16 from the next level so 16 + 1 − 8 = 9 .
4 Last step is to calculate  C − 4  but because we borrowed 1 during the previous step we have to reduce  1,  so, we have   C − 1 − 4 = 7.
And the final value is:  79B2.

Find the subtraction of the following binary numbers N12 = 11101 minus N22 = 10110.
We perform the following steps.

0 -1 2 2 0 ← Borrow
N12 = 1 1 1 0 1
N22 = 1 0 1 1 0
N12 − N22 = 0 0 1 1 1

Step Description
1 calculate   1 − 0 = 1
2 Calculate  0 − 1,   because 0 is less than   1   we borrow from the next level   2,  and get 2 + 0 − 1 = 1
3 because we borrowed in the previous step, we have to reduce 1 so we have 1 − 1 = 0. and again because 0 is less than 1 we have to borrow from the next level, so, 2 + 0 − 1 = 1
4 Last step is to calculate  1 − 1 − 0 = 0
5 Last step is:  1 − 1 − 0 = 0

Multiplication, Numbers in Different Bases

Print multiplication

First let analyse the base 10 multiplication of the numbers:  N110 = 702  and  N210 = 36.

We calculate the numbers by two steps as follow:

Step - 1 Step - 2
7 0 2 7 0 2
× 6 × 3
4 2 1 2 2 1 0 6

Adding the two steps results as described at the next step:

N110 = 7 0 2
N210 = × 3 6
4 2 1 2
2 1 0 6
N110 × N210 = 2 5 2 7 2

The same calculation process is performed on the multiplication of other numbers in any base, for example find the multiplication of the two base 4 numbers where  N14 = 1301  and  N24 = 203.

STEP 1
1 3 0 1
3
1 1 1 0 3
1 × 3 = 3
0 × 3 = 0
3 × 3 = 9 / 4 → remain = 1, carry = 2
1 × 3 = 3 + carry = 5 / 4 = remain 1 carry 1
STEP 2
1 3 0 1
0
0 0 0 0
1 × 0 = 0
0 × 0 = 0
3 × 0 = 0
1 × 0 = 0
STEP 3
1 3 0 1
2
3 2 0 2
1 × 2 = 2
0 × 2 = 0
3 × 2 = 6 / 4 → remain = 2, carry = 1
1 × 2 = 2 + carry = 3

And the multiplication is equal to:

N14 = 1 3 0 1
N24 = 2 0 3
1 1 1 0 3
0 0 0 0
3 2 0 2
N14 × N24 = 3 3 1 3 0 3

Now we will examine the multiplication of two binary numbers,  N12 = 11001  and  N22 = 101.

The multiplication rules can be found in the table

STEP 1
1 1 0 0 1
1
1 1 0 0 1
1 × 1 = 1
0 × 1 = 0
0 × 1 = 0
1 × 1 = 1
1 × 1 = 1
STEP 2
1 1 0 0 1
0
0 0 0 0 0
1 × 0 = 0
0 × 0 = 0
0 × 0 = 0
1 × 0 = 0
1 × 0 = 0

And the multiplication is equal to:

N12 = 1 1 0 0 1
N22 = 1 0 1
1 1 0 0 1
0 0 0 0 0
1 1 0 0 1
N12 × N22 = 1 1 1 1 1 0 1

Notice: that a left shift of bits is equivalent to multiplying the number by 2, each time a left shift is performed, see the following table:

Decimal 64 32 16 8 4 2 1 Value
0 0 0 0 0 1 1 3
0 0 0 0 1 1 0 6
0 0 0 1 1 0 0 12
0 0 1 1 0 0 0 24
0 1 1 0 0 0 0 48
1 1 0 0 0 0 0 96

The same way a right shift is equivalent to dividing the number by 2.