This article will help you know how to convert between the number systems. The first thing to pay attention to is how to convert from **base 10** to **any base system** like 2, 8, 16 and vice versa. In addition, how to convert between the base systems 2, 8, 16 will also be mentioned.

**1. Convert base b to base 10**

*A*_{(b)}= A’_{(10)}*A’*_{(10)}= a_{n}b^{n}+ a_{n-1}b^{n-1}+…+ a_{0}b^{0}+ a_{-1}b^{-1}+…+ a_{-m}b^{-m}**Example**:

(6 5 4 3 2 1 0 -1 -2 -3 -4) is the exponent

1 1 0 1 0 0 1 . 1 0 1 1_{(2)}

= 1.2^{6} + 1.2^{5} + 0.2^{4} + 1.2^{3} + 0.2^{2} + 0.2^{1} + 1.2^{0} + 1.2^{-1} + + 0.2^{-2} + 1.2^{-3} + 1.2^{-4}

= 64 + 32 + 8 + 1 + 0.5 + 0.125 + 0.0625

= 105.6875_{(10)}

**2. Convert base 10 to base b**

**Whole-number part conversion**: Take the whole-number part of N_{(10)} and divide by b to get quotient and remainder. Then take quotient divide by b to get quotient and remainder, repeating this operation until the quotient is 0. The result of the conversion M_{(b)} is the remainders in the division written out in reverse order.

**Decimal part conversion**: Take the decimal part (after the comma) of N_{(10)} and multiply by b to get whole-number part and decimal part. Then take decimal part multiply by b to get whole-number part and decimal part, repeating this operation until the decimal part is 0. The result of the conversion number M_{(b)} is the integer part numbers in the multiplication, are written in order of multiplication.

**3. How to convert between base systems 2, 8, 16**

**3.1. Convert from base 2 to base 8**

**Rule**: A sequence of 3 consecutive bits from right to left in base 2 will correspond to a number in base 8.

**Example**: **111111111110**_{(2)} = ?_{(8)}

Gather 3 bits from right to left (**111**)(**111**)(**111**)(**110**) to get (7) (7) (7) (6)

**Result**: 111111111110_{(2)} = 7776_{(8)}

**3.2. Convert from base 2 to base 16**

**Quy tắc**: A sequence of 4 consecutive bits from right to left in base 2 will correspond to a number in base 16.

**Example**: 11111111111111111110_{(2)} = ?_{(16)}

Gather 4 bits from right to left (**1111**)(**1111**)(**1111**)(**1111**)(**1110**) to get (15) (15) (15) (15) (14)

**Result**: 11111111111111111110_{(2)} = FFFFE_{(16)}

**3.3. Convert from base 8 to base 2**

**Rule: **A digit in base 8 will correspond to a sequence of 3 consecutive bits in base 2.

**Example**: 27_{(8) }= ?_{ (2)}

Convert each digit (**2**) (**7**) into 3 consecutive bit (**010**) (**111**)

**Result**: 27_{(8)} = 010111_{(2)}

**3.4. Convert from base 16 to base 2**

**Rule: **A digit in base 16 will correspond to a sequence of 4 consecutive bits in base 2.

**Example**: 27_{(16) }= ?_{ (2)}

Convert each digit (**2**) (**7**) into 4 consecutive bit (**0010**) (**0111**)

**Result**: 27_{(16)} = 00100111_{(2)}

**3.5. Convert from base 8 to base 16 and vice versa**

**The most simple way** is to change base 8 to base 2 and then change to base 16.

**Example**: 27_{(8) }= ?_{ (16)}

Convert each digit (**2**) (**7**) into 3 consecutive bit (**010**) (**111**). We get binary sequence 010111_{(2)}. Convert to base 16 by gathering 4 bits from right to left (**0001**)(**0111**) to get (**1**)(**7**).

**Result**: 27_{(8)} = 00010111_{(2)} = 17_{(16)}