Number System and Base Conversion
Any base to Base10, Base10 to any Base, Any Other Base to any Other Base
Section titled “Any base to Base10, Base10 to any Base, Any Other Base to any Other Base”1. From any base to Decimal (Base-10)
Section titled “1. From any base to Decimal (Base-10)”- Multiply each digit by its base raised to the positional power.
- Add all results.
- Example:
(1011)₂todecimal:
1×2³ + 0×2² + 1×2¹ + 1×2⁰= 8 + 0 + 2 + 1= 11₁₀If the binary number is a float, you convert integer part and fractional part separately: ⭐
Steps:
- Integer part → Multiply each bit by
2^naccording to its position (same as normal). - Fractional part → Multiply each bit by
2^(-n)according to its position after the point.
- Example:
(11001.101)₂tobase-10
Integer part (11001):
1×2⁴ + 1×2³ + 0×2² + 0×2¹ + 1×2⁰= 16 + 8 + 0 + 0 + 1= 25
Fractional part (.101):
1×2⁻¹ + 0×2⁻² + 1×2⁻³= 0.5 + 0 + 0.125= 0.625
Final:(11001.101)₂ = (25.625)₁₀2. From Decimal to Any Base
Section titled “2. From Decimal to Any Base”- Repeatedly divide the decimal number by the target base.
- Write remainders in reverse order.
- Example:
(25)₁₀tobase-2:
25 ÷ 2 = 12 remainder 112 ÷ 2 = 6 remainder 06 ÷ 2 = 3 remainder 03 ÷ 2 = 1 remainder 11 ÷ 2 = 0 remainder 1→ 11001₂If the decimal number is a float, you convert integer part and fractional part separately: ⭐
Steps:
- Integer part → Use repeated division by
base(same as normal). - Fractional part → Multiply repeatedly by
base, take the integer part each time as the next digit.
- Example:
(25.625)₁₀tobase-2
Integer part (25):
25 ÷ 2 = 12 remainder 112 ÷ 2 = 6 remainder 06 ÷ 2 = 3 remainder 03 ÷ 2 = 1 remainder 11 ÷ 2 = 0 remainder 1→ 11001
Fractional part (0.625):
0.625 × 2 = 1.25 → 10.25 × 2 = 0.5 → 00.5 × 2 = 1.0 → 1→ .101
Final:(25.625)₁₀ = (11001.101)₂3. From One Non-Decimal Base to Another
Section titled “3. From One Non-Decimal Base to Another”- Convert to decimal first, then to target base.
- Example: (27)₈ to base-2:
1. (27)₈ = 2×8¹ + 7×8⁰ = 16 + 7 = 23₁₀
2. 23₁₀ = 10111₂Base Conversion
Section titled “Base Conversion”1. Binary to Decimal Conversion
Steps:
- Write Down the Binary Number:
- Example:
1101
- Example:
- Identify the Positional Values:
- Each bit represents a power of 2, starting from (2^0) for the rightmost bit.
- Multiply Each Bit by Its Corresponding Power of 2:
- For
1101:1 \times 2^3 = 81 \times 2^2 = 40 \times 2^1 = 01 \times 2^0 = 1
- For
- Sum the Results:
8 + 4 + 0 + 1 = 13
Result:
- Binary
1101is decimal13.
2. Decimal to Binary Conversion
Steps:
- Divide the Decimal Number by 2:
- Record the remainder.
- Divide the Quotient by 2:
- Continue dividing and recording remainders until the quotient is 0.
- Write Down the Remainders in Reverse Order:
- This gives the binary representation.
Example: Convert 13 to Binary
13 ÷ 2 = 6with remainder16 ÷ 2 = 3with remainder03 ÷ 2 = 1with remainder11 ÷ 2 = 0with remainder1
Result:
- Binary representation is
1101.
3. Hexadecimal to Decimal Conversion
Steps:
- Write Down the Hexadecimal Number:
- Example:
0x2F3
- Example:
- Identify the Positional Values:
- Each digit represents a power of 16, starting from (16^0) for the rightmost digit.
- Convert Each Hexadecimal Digit to Decimal:
2,F (15), and3.
- Multiply Each Digit by Its Corresponding Power of 16:
- For
0x2F3:3 \times 16^0 = 315 \times 16^1 = 2402 \times 16^2 = 512
- For
- Sum the Results:
512 + 240 + 3 = 755
Result:
- Hexadecimal
0x2F3is decimal755.
4. Decimal to Hexadecimal Conversion
Steps:
- Divide the Decimal Number by 16:
- Record the remainder (convert to hexadecimal if needed).
- Divide the Quotient by 16:
- Continue dividing and recording remainders until the quotient is 0.
- Write Down the Remainders in Reverse Order:
- This gives the hexadecimal representation.
Example: Convert 755 to Hexadecimal
755 ÷ 16 = 47with remainder747 ÷ 16 = 2with remainder15(F in hexadecimal)2 ÷ 16 = 0with remainder2
Result:
- Hexadecimal representation is
0x2F7.
5. Binary to Hexadecimal Conversion
Steps:
- Group the Binary Digits into Sets of Four (from right to left):
- Example:
10111011becomes1011 1011.
- Example:
- Convert Each Group to Hexadecimal:
1011isB1011isB
Result:
- Binary
10111011is hexadecimal0xBB.
6. Hexadecimal to Binary Conversion
Steps:
- Convert Each Hexadecimal Digit to Its 4-Bit Binary Equivalent:
- Example:
0x2F3:2is0010Fis11113is0011
- Example:
- Combine All Binary Groups:
Result:
- Hexadecimal
0x2F3is binary0010 1111 0011.