Data Representation Study Sheet

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 ANY Other Number Base to Decimal (base 10)

Converting TO a decimal number requires using the positional notation system to calculate the decimal value of each digit in the original base:

  1. Start with the original number.
  2. Multiply each digit by the original base raised to the correct power, starting from the rightmost digit:
    • Rightmost digit times base to the zero power, which is ALWAYS one
    • Second digit times base to the first power, which is ALWAYS the base itself
    • Third digit times base to the second power (the base squared)
    • Fourth digit times base to the third power (the base cubed)
    • and so on for each digit in the original number
  3. When all the digits have been converted to their decimal value, add up the decimal values.
  4. The result is the converted value in decimal.
Example: Convert 754 in base 8 to base 10:

 

 

4 * 8 to the 0 power = 4 * 1 = 4
5 * 8 to the 1 power = 5 * 8 = 40
7 * 8 to the 2 power = 7 * 64 = 448

448 + 40 + 4 = 492 in base 10

Example: Convert F3A in base 16 to base 10:

 

 

A * 16 to the 0 power = 10 * 1 = 10
3 * 16 to the 1 power = 3* 16= 48
F * 16 to the 2 power = 15 * 256= 3840

3840 + 48 + 10 = 3898 in base 10

Example: Convert 11101 in base 2 to base 10:

 

 

1 * 2 to the 0 power = 1 * 1 = 1
0 * 2 to the 1 power = 0 * 2 = 0
1 * 2 to the 2 power = 1 * 4 = 4
1 * 2 to the 3 power = 1 * 8 = 8
1 * 2 to the 4 power = 1 * 16 = 16

16 + 8 + 4 + 1 = 29 in base 10

Converting Decimal to ANY Other Number Base

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

  1. Divide your decimal value by the base you are converting to. Stop dividing when you get a remainder that is less than your base (in other words, don’t go past the decimal point).
  2. Take the remainder (remember, it’s less than the base!) and make it the RIGHTMOST digit in your converted number.
    Note: if you are converting to a base greater than 10, AND that remainder is 10 or greater, you MUST convert that two-digit remainder to a single digit in your target base.
  3. Now look at your quotient. Is it zero? If so, you are DONE (HOORAY!!).
  4. If not, take that quotient, and divide it by the base you are converting to. Stop dividing when you get a remainder that is less than your base (in other words, don’t go past the decimal point). Yes, this is basically repeating step 1.
  5. Take the remainder from step 4, and make it the NEXT digit to the LEFT (repeat, LEFT!!!) in your converted number. You MUST build the number from RIGHT to LEFT.
  6. Go back to step 3.
Example: Convert 1192 from base 10 to base 2

1192 / 2 = 596, remainder 1 -> 0
596 / 2 = 298, remainder 0 -> 00
298 / 2 = 149, remainder 0 -> 000
149 / 2 = 74, remainder 1 -> 1000
74 / 2 = 37, remainder 0 -> 01000
37 / 2 = 18, remainder 1 -> 101000
18 / 2 = 9, remainder 0 -> 0101000
9 / 2 = 4, remainder 1 -> 10101000
4 / 2 = 2, remainder 0 -> 010101000
2 / 2 = 1, remainder 0 -> 0010101000
1 / 2 = 0, remainder 1 -> 10010101000
DONE, quotient is zero

Example: Convert 1192 from base 10 to base 8

1192 / 8 = 149, remainder 0 -> 0
149 / 8 = 18, remainder 5 -> 50
18 / 8 = 2, remainder 2 -> 250
2 / 8 = 0, remainder 2 -> 2250
DONE, quotient is zero

Example: Convert 1192 from base 10 to base 16

1192 / 16 = 74, remainder 8 -> 8
74 / 16 = 4, remainder 10 (A) -> A8
4 / 16 = 0, remainder 4 -> 4A8
DONE, quotient is zero

Converting Between Binary and Octal

Binary to Octal:

  1. Starting from the right of the binary number, split the number into groups of three binary digits.
  2. Look up each group of three binary digits in the accompanying table to find the octal digit that represents that amount. Write down the octal digit in the same position as the four binary digits.

Example: Convert 11010001 from binary to octal.

11 010 001

011 -> 3, 010 -> 2, 001 -> 1

11010001 = 321

Octal to Binary:

  1. Working in EITHER direction (this is one of the few times it doesn’t matter), take each octal digit and look it up in the accompanying table to find the corresponding three binary digits.
  2. Write down the binary digits in the same order as the original octal digits.
  3. (Optional) Add leading zeroes on the left of the binary digits to get a total number of digits that is a multiple of eight.

Example: Convert 7361 from octal to binary.

7 -> 111, 3 -> 001, 6 -> 110, 1 -> 011, so 7361 in octal = 00001110 01110011 in binary.

Binary Octal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

 

Converting Between Binary and Hexadecimal

Binary to Hexadecimal:

  1. Starting from the right of the binary number, split the number into groups of four binary digits.
  2. Look up each group of four binary digits in the accompanying table to find the hexadecimal digit that represents that amount. Write down the hexadecimal digit in the same position as the four binary digits.

Example: Convert 11010001 from binary to hexadecimal.

1101 0001

1101 -> D
0001 -> 1

11010001 = D1

Hexadecimal to Binary:

  1. Working in EITHER direction (this is one of the few times it doesn’t matter), take each hexadecimal digit and look it up in the accompanying table to find the corresponding four binary digits.
  2. Write down the binary digits in the same order as the original hexadecimal digits.

Example: Convert C7A from hexadecimal to binary.

C -> 1100, 7 -> 0111, A -> 1010, so C7A = 00001100 01111010 in binary.

Binary Hexadecimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

 

Converting Between Octal and Hexadecimal

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

Print Friendly, PDF & Email