Note on the Theoretical Background of Number Base Converter (Changer)
This section explains how to convert (change) numbers between different bases. It covers decimal to other bases, other bases to decimal, and direct base-to-base conversions.
1. Converting from Base 10 to Other Bases
To convert (change) a decimal number to another base, repeatedly divide the number by the target base, recording the remainders. The base-n representation is obtained by reading the remainders in reverse order.
1.1 Conversion from Base 10 to Base 2 (Binary)
Binary uses only 0 and 1. Divide the number by 2 and keep the remainders.
Convert \( 45_{10} \) to base 2:
\( 45 \div 2 = 22 \) remainder \( 1 \)
\( 22 \div 2 = 11 \) remainder \( 0 \)
\( 11 \div 2 = 5 \) remainder \( 1 \)
\( 5 \div 2 = 2 \) remainder \( 1 \)
\( 2 \div 2 = 1 \) remainder \( 0 \)
\( 1 \div 2 = 0 \) remainder \( 1 \)
Result: \( 101101_2 \)
1.2 Conversion from Base 10 to Base 3 (Ternary)
Base 3 uses 0, 1, and 2. Divide by 3 and record remainders.
Convert \( 45_{10} \) to base 3:
\( 45 \div 3 = 15 \) remainder \( 0 \)
\( 15 \div 3 = 5 \) remainder \( 0 \)
\( 5 \div 3 = 1 \) remainder \( 2 \)
\( 1 \div 3 = 0 \) remainder \( 1 \)
Result: \( 1200_3 \)
1.3 Conversion from Base 10 (Decimal) to Base 4 (Quaternary)
Base 4 uses the digits 0, 1, 2, and 3. We follow the same repeated division method.
Convert \( 45_{10} \) to base 4:
\( 45 \div 4 = 11 \) remainder \( 1 \)
\( 11 \div 4 = 2 \) remainder \( 3 \)
\( 2 \div 4 = 0 \) remainder \( 2 \)
Result: \( 231_4 \).
1.4 Conversion from Base 10 (Decimal) to Base 8 (Octal)
Octal (base 8) uses digits 0 to 7. We divide by 8 and record the remainders.
Convert \( 45_{10} \) to base 8:
\( 45 \div 8 = 5 \) remainder \( 5 \)
\( 5 \div 8 = 0 \) remainder \( 5 \)
Result: \( 55_8 \).
1.5 Conversion from Base 10 (Decimal) to Base 12 (Duodecimal)
Base 12 uses the digits 0 to 9, plus letters A and B for 10 and 11.
Convert \( 45_{10} \) to base 12:
\( 45 \div 12 = 3 \) remainder \( 9 \)
Result: \( 39_{12} \).
1.6 Conversion from Base 10 (Decimal) to Base 16 (Hexadecimal)
Hexadecimal (base 16) uses digits 0 to 9, plus A-F for 10 to 15.
Convert \( 45_{10} \) to base 16:
\( 45 \div 16 = 2 \) remainder \( 13 \) (which is D in hexadecimal)
Result: \( 2D_{16} \).
2. Converting from Other Bases to Base 10
To convert (change)a number \( d_n d_{n-1} \dots d_1 d_0 \) from base \( b \) to decimal, expand it using positional notation:
\( d_n \) |
\( d_{n-1} \) |
\(\dots\) |
\( d_1 \) |
\( d_0 \) |
\( b^n \) |
\( b^{n-1} \) |
\(\dots\) |
\( b^1 \) |
\( b^0 \) |
\( N_b = d_n \times b^n + d_{n-1} \times b^{n-1} + \dots + d_1 \times b^1 + d_0 \times b^0 \)
To convert (change)a number to decimal, multiply each digit by the base raised to its position. Add the results.
2.1 Conversion from Base 2 to Base 10
Convert \( 101101_2 \) to decimal:
\( 1 \) |
\( 0 \) |
\( 1 \) |
\( 1 \) |
\( 0 \) |
\( 1 \) |
\( 2^5 \) |
\( 2^4 \) |
\( 2^3 \) |
\( 2^2 \) |
\( 2^1 \) |
\( 2^0 \) |
\( 1 \times 2^5 + 0 \times 2^4 + 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 \)
\( = 32 + 0 + 8 + 4 + 0 + 1 = 45_{10} \)
2.2 Conversion from Base 3 to Base 10
Convert \( 1200_3 \) to decimal:
\( 1 \) |
\( 2 \) |
\( 0 \) |
\( 0 \) |
\( 3^3 \) |
\( 3^2 \) |
\( 3^1 \) |
\( 3^0 \) |
\( 1 \times 3^3 + 2 \times 3^2 + 0 \times 3^1 + 0 \times 3^0 \)
\( = 27 + 18 + 0 + 0 = 45_{10} \)
2.3 Conversion from Base 5 to Base 10
Convert \( 143_5 \) to decimal:
\( 1 \) |
\( 4 \) |
\( 3 \) |
\( 5^2 \) |
\( 5^1 \) |
\( 5^0 \) |
\( 1 \times 5^2 + 4 \times 5^1 + 3 \times 5^0 \)
\( = 25 + 20 + 3 = 48_{10} \)
2.4 Conversion from Base 8 to Base 10
Convert \( 57_8 \) to decimal:
\( 5 \) |
\( 7 \) |
\( 8^1 \) |
\( 8^0 \) |
\( 5 \times 8^1 + 7 \times 8^0 \)
\( = 40 + 7 = 47_{10} \)
2.5 Conversion from Base 12 to Base 10
Convert \( 3B_{{12}} \) to decimal (where B = 11):
\( 3 \) |
\( B (11) \) |
\( 12^1 \) |
\( 12^0 \) |
\( 3 \times 12^1 + 11 \times 12^0 \)
\( = 36 + 11 = 47_{10} \)
2.6 Conversion from Base 16 to Base 10
Convert \( 2D_{16} \) to decimal (where D = 13):
\( 2 \) |
\( D (13) \) |
\( 16^1 \) |
\( 16^0 \) |
\( 2 \times 16^1 + 13 \times 16^0 \)
\( = 32 + 13 = 45_{10} \)
3. Direct Base-to-Base Conversions
Some bases can be converted directly without using an intermediate step through decimal (Base 10). However, the most systematic approach is to first convert the number to decimal (Base 10) and then convert from decimal to the target base.
3.1 Conversion from Base 2 to Base 8
Step 1: Convert \( 110101_2 \) to decimal (Base 10).
\( 1 \) |
\( 1 \) |
\( 0 \) |
\( 1 \) |
\( 0 \) |
\( 1 \) |
\( 2^5 \) |
\( 2^4 \) |
\( 2^3 \) |
\( 2^2 \) |
\( 2^1 \) |
\( 2^0 \) |
\( 1 \times 2^5 + 1 \times 2^4 + 0 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 \)
\( = 32 + 16 + 0 + 4 + 0 + 1 = 53_{10} \)
Step 2: Convert \( 53_{10} \) to octal (Base 8).
\( 53 \div 8 = 6 \) remainder \( 5 \)
Result: \( 65_8 \).
3.2 Conversion from Base 4 to Base 12
Step 1: Convert \( 321_4 \) to decimal (Base 10).
\( 3 \) |
\( 2 \) |
\( 1 \) |
\( 4^2 \) |
\( 4^1 \) |
\( 4^0 \) |
\( 3 \times 4^2 + 2 \times 4^1 + 1 \times 4^0 \)
\( = 48 + 8 + 1 = 57_{10} \)
Step 2: Convert \( 57_{10} \) to duodecimal (Base 12).
\( 57 \div 12 = 4 \) remainder \( 9 \)
Result: \( 49_{12} \).
3.3 Conversion from Base 8 to Base 12
Step 1: Convert \( 47_8 \) to decimal (Base 10).
\( 4 \times 8^1 + 7 \times 8^0 = 32 + 7 = 39_{10} \)
Step 2: Convert \( 39_{10} \) to duodecimal (Base 12).
\( 39 \div 12 = 3 \) remainder \( 3 \)
Result: \( 33_{12} \).
3.4 Conversion from Base 12 to Base 4
Step 1: Convert \( 49_{12} \) to decimal (Base 10).
\( 4 \times 12^1 + 9 \times 12^0 = 48 + 9 = 57_{10} \)
Step 2: Convert \( 57_{10} \) to quaternary (Base 4).
\( 57 \div 4 = 14 \) remainder \( 1 \)
\( 14 \div 4 = 3 \) remainder \( 2 \)
Result: \( 321_4 \).
3.5 Conversion from Base 12 to Base 8
Step 1: Convert \( 68_{12} \) to decimal (Base 10).
\( 6 \times 12^1 + 8 \times 12^0 \)
\( = 72 + 8 = 80_{10} \)
Step 2: Convert \( 80_{10} \) to octal (Base 8).
\( 80 \div 8 = 10 \) remainder \( 0 \)
\( 10 \div 8 = 1 \) remainder \( 2 \)
Result: \( 120_8 \).
3.6 Conversion from Base 16 to Base 8
Step 1: Convert \( A3_{16} \) to decimal (Base 10).
\( A \times 16^1 + 3 \times 16^0 \) (where \( A = 10 \))
\( = 10 \times 16 + 3 \times 1 = 160 + 3 = 163_{10} \)
Step 2: Convert \( 163_{10} \) to octal (Base 8).
\( 163 \div 8 = 20 \) remainder \( 3 \)
\( 20 \div 8 = 2 \) remainder \( 4 \)
Result: \( 243_8 \).
References