The correct method for converting numbers from one base to another depends on your starting base and your target base. It is critical to use the right method for the conversion, since you will get completely wrong results otherwise. The various types of conversions that we use, and the appropriate methods, are summarized below, with examples.
Converting TO a decimal number requires using the positional notation system to calculate the decimal value of each digit in the original base:
| Example: Convert 754 in base 8 to base 10:
4 * 8 to the 0 power = 4 * 1 = 4 |
Example: Convert F3A in base 16 to base 10:
A * 16 to the 0 power = 10 * 1 = 10 |
Example: Convert 11101 in base 2 to base 10:
1 * 2 to the 0 power = 1 * 1 = 1 |
Converting FROM a decimal number to any other number base involves determining how many times each power of the new base goes into the decimal number. This means you have to remember how to do "long division" with quotients and remainders, as opposed to division with decimals or fractions
|
Example: Convert 1192 from base 10 to base 2 1192 / 2 = 596, remainder 1 -> 1 |
Example: Convert 1192 from base 10 to base 8 1192 / 8 = 149, remainder 0 -> 0 |
Example: Convert 1192 from base 10 to base 16 1192 / 16 = 74, remainder 8 -> 8 |
|
Binary to Octal:
Example: Convert 11010001 from binary to octal. 11 010 001 011 -> 3, 010 -> 2, 001 -> 1 11010001 = 321 Octal to Binary:
Example: Convert 7361 from octal to binary. 7 -> 111, 3 -> 001, 6 -> 110, 1 -> 011, so 7361 in octal = 00001110 01110011 in binary. |
|
|
Binary to Hexadecimal:
Example: Convert 11010001 from binary to hexadecimal. 1101 0001 1101 -> D 11010001 = D1 Hexadecimal to Binary:
Example: Convert C7A from hexadecimal to binary. C -> 1100, 7 -> 0111, A -> 1010, so C7A = 00001100 01111010 in binary. |
|
This conversion can be done directly if you REALLY want to, but I don't recommend it at all. It's far, far easier to convert from the starting base to binary, as described above, then from binary to the target base. Doing it this way means you don't have to do any actual calculation at all!
| Convert 741 in base 8 to base 16
7 4 1 -> 111 100 011 -> 111100011 -> 1 1110 0011 -> 1 E 3 741 in base 8 is 1E3 in base 16 |
Convert EB7 in base 16 to base 8
E B 7 -> 1110 1011 0111 -> 111010110111 -> 111 010 110 111 -> 7 2 6 3 EB7 in base 16 is 7263 in base 8 |