The decimal number system is the one that most people are familiar with. It is also called base-10, which means that it consists of ten digits (0-9). The first digit to the left of the decimal point represents ones, or units (10^{0}). The second digit is the tens (10^{1}), the third digit is the hundreds (10^{2}), the fourth digit is the thousands (10^{3}), and so on. To the right of the decimal point, the digits are fractional, with the first digit representing tenths (10^{-1}), the second digit hundredths (10^{-2}), the third digit thousandths (10^{-3}), etc. These are shown in the following example:

1,248.327_{10} = 1 × 10^{3} + 2 × 10^{2} + 4 × 10^{1} + 8 × 10^{0} + 3 × 10^{-1} + 2 × 10^{-2} + 7 × 10^{-3}

The subscript 10 indicates that this is a number from the base-10 system, but in normal practice it is omitted, because numbers are assumed to be decimal unless otherwise specified.

Just as the base-10 system has ten digits, the base-2, or binary number system, has two digits--0 and 1. In the decimal system, each place has a value ten times that of the place to the right; in the binary system, the value of each place is twice that of the place to the right. The digit immediately to the left of the binary point represents ones, or units (2^{0}), the second represents twos (2^{1}), the next fours (2^{2}), then eights (2^{3}), and so on. To the right of the binary point, the places are 2^{-1} (1/2, or .5), 2^{-2} (1/4, or .25), 2^{-3} (1/8, or .125), etc. These are shown in following example:

1101.101_{2} = 1 × 2^{3} + 1 × 2^{2} + 0 × 2^{1} + 1 × 2^{0} + 1 × 2^{-1} + 0 × 2^{-2} + 1 × 2^{-3}

The octal number system, as the name suggests, has eight digits--0-7. Each place has a value eight times that of the place to the right. The digit immediately to the left of the octal point represents ones, or units (8^{0}), the second represents eights (8^{1}), the next sixty-fours (8^{2}), then five-hundred-twelves (8^{3}), etc. To the right of the octal point, the places are 8^{-1} (1/8, or .125), 8^{-2} (1/64, or .015625), 8^{-3} (1/512, or .001953125), etc. For example:

637.25_{8} = 6 × 8^{2} + 3 × 8^{1} + 7 × 8^{0} + 2 × 8^{-1} + 5 × 8^{-2}

The hexadecimal, or base-16, number system contains sixteen symbols--the digits 0-9, and the letters A-F to represent the values 10-15. Each place has a value 16 times that of the place to the right. The digit immediately to the left of the hexadecimal point represents ones, or units (16^{0}), the second represents sixteens (16^{1}), the next two-hundred-fifty-sixes (16^{2}), then four-thousand-ninety-sixes (16^{3}), etc. To the right of the hexadecimal point, the places are 16^{-1} (1/16, or .0625), 16^{-2} (1/256, or .00390625), 16^{-3} (1/4,096, or .000244140625), etc. For example:

2A4.63_{16} = 2 × 16^{2} + 10 × 16^{1} + 4 × 16^{0} + 6 × 16^{-1} + 3 × 16^{-2}

This method uses repeated division by 2. When a number is divided by 2, the only possible remainders are 0 or 1. Keep dividing until the quotient becomes 0; the remainders make up the binary number. In this example, 837_{10} is converted to binary.

Decimal | ÷ 2 | Quotient | Remainder |
---|---|---|---|

837 | ÷ 2 = | 418 | 1 |

418 | ÷ 2 = | 209 | 0 |

209 | ÷ 2 = | 104 | 1 |

104 | ÷ 2 = | 52 | 0 |

52 | ÷ 2 = | 26 | 0 |

26 | ÷ 2 = | 13 | 0 |

13 | ÷ 2 = | 6 | 1 |

6 | ÷ 2 = | 3 | 0 |

3 | ÷ 2 = | 1 | 1 |

1 | ÷ 2 = | 0 | 1 |

Starting from the bottom, list the digits from the remainder column: the result is 1101000101_{2}, which equals 837_{10}.

Another method is to create a table, starting at 2^{0}, and listing as many powers of 2 as necessary to cover the number being converted; in this case, that is 2^{9}, or 512_{10}. If dealing with fractions, list negative powers of 2 to the right of 2^{0}.

In the second row, convert the powers to their decimal equivalents. In the third row, start with the highest number and determine how many times it fits into the number being converted; 512 fits into 837 one time, so a 1 is entered in row 3. Subtract 512 from 837, which leaves 325. Move to the next column, and determine how many times 256 fits into 325; it is one, so place a 1 in row 3. Subtract 256 from 325; 69 remains. The next column is 128, which won’t fit into 69, so a 0 is entered in row 3. Keep following this procedure until all of the spaces in row 3 are filled in--if a number fits, enter a 1; if not, enter a 0.

Finally, create a fourth row listing the products of rows 2 and 3. Add these products, and the final result is 837_{10}--the same as with the previous method.

2^{x} |
2^{9} |
2^{8} |
2^{7} |
2^{6} |
2^{5} |
2^{4} |
2^{3} |
2^{2} |
2^{1} |
2^{0} |
2^{-1} |
---|---|---|---|---|---|---|---|---|---|---|---|

Decimal | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | .5 |

How many? | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | - |

= | 512 | 256 | 0 | 64 | 0 | 0 | 0 | 4 | 0 | 1 | - |

512 + 256 + 64 + 4 + 1 = 837_{10}

This method is similar to the first one described for converting decimal to binary, except division by 8 is used. Keep dividing until the quotient becomes 0; the remainders make up the octal number.

Decimal | ÷ 8 | Quotient | Remainder |
---|---|---|---|

837 | ÷ 8 = | 104 | 5 |

104 | ÷ 8 = | 13 | 0 |

13 | ÷ 8 = | 1 | 5 |

1 | ÷ 8 = | 0 | 1 |

Starting from the bottom, list the digits from the remainder column: the result is 1505_{8}, which equals 837_{10}.

As demonstrated previously, a table can be created. Start at 8^{0}, and list as many powers of 8 as necessary to cover the number being converted; in this case, that is 8^{3}, or 512_{10}. If dealing with fractions, list negative powers of 8 to the right of 8^{0}.

In the second row, convert the powers to their decimal equivalents. In the third row, start with the highest number and determine how many times it fits into the number being converted; 512 fits into 837 one time, so a 1 is entered in row 3. Subtract 512 from 837, which leaves 325. Move to the next column, and determine how many times 64 fits into 325, which is five, so place a 5 in row 3. 5 times 64 is 320, so subtract 320 from 325; 5 remains. The next column is 8, which won’t fit into 5, so a 0 is entered in row 3. The next column is 1s, which fits into 5 five times; enter a 5 in row 3.

Finally, create a fourth row listing the products of rows 2 and 3. Add these products, and the final result is 837_{10}--the same as with the previous method.

8^{x} |
8^{3} |
8^{2} |
8^{1} |
8^{0} |
8^{-1} |
---|---|---|---|---|---|

Decimal | 512 | 64 | 8 | 1 | .125 |

How many? | 1 | 5 | 0 | 5 | - |

= | 512 | 320 | 0 | 5 | - |

512 + 320 + 5 = 837_{10}

Dividing by 16 is used here. Keep dividing until the quotient becomes 0; the remainders make up the hexadecimal number.

Decimal | ÷ 16 | Quotient | Remainder |
---|---|---|---|

837 | ÷ 16 = | 52 | 5 |

52 | ÷ 16 = | 3 | 4 |

3 | ÷ 16 = | 0 | 3 |

Starting from the bottom, list the digits from the remainder column: the result is 345_{16}, which equals 837_{10}.

Note: If the remainder is greater than 9_{10}, use the appropriate hexadecimal digit:

Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |

Alternatively, a table can be used for conversion. Start at 16^{0}, and list as many powers of 16 as necessary to cover the number being converted; in this case, that is 16^{2}, or 256_{10}. If dealing with fractions, list negative powers of 16 to the right of 16^{0}.

In the second row, convert the powers to their decimal equivalents. In the third row, start with the highest number and determine how many times it fits into the number being converted; 256 fits into 837 three times, so a 3 is entered in row 3. 3 x 256 = 768, so subtract 768 from 837, which leaves 69. Move to the next column, and determine how many times 16 fits into 69, which is four, so place a 4 in row 3; since 4 x 16 = 64, this leaves 5. The next column is 1s, which fits into 5 five times, so enter a 5 in row 3.

Finally, create a fourth row listing the products of rows 2 and 3. Add these products, and the final result is 837_{10}--the same as with the previous method.

16^{x} |
16^{2} |
16^{1} |
16^{0} |
16^{-1} |
---|---|---|---|---|

Decimal | 256 | 16 | 1 | .0625 |

How many? | 3 | 4 | 5 | - |

= | 768 | 64 | 5 | - |

768 + 64 + 5 = 837_{10}

Partition the binary digits into groups of three (octets), starting with the least significant digit. Pad the most significant digit with zeros to complete an octet, as necessary:

11100101_{2} = 10 | 100 | 101 = 010 | 100 | 101

Each octet can have a maximum value of 111_{2}, which equates to 7_{8}. In the example above, 010_{2} = 2_{8}, 100_{2} = 4_{8}, and 101_{2} = 5_{8}, so 11100101_{2} = 245_{8}.

Binary | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
---|---|---|---|---|---|---|---|---|

Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Partition the binary digits into groups of four (quartet), starting with the least significant digit. Pad the most significant digit with zeros to complete a quartet, as necessary:

110010000111_{2} = 1100 | 1000 | 0111

Each quartet can have a maximum value of 1111_{2}, which equates to F_{16}. In the example above, 1100_{2} = C_{16}, 1000_{2} = 8_{16}, and 0111_{2} = 7_{16}, so 110010000111_{2} = C87_{16}.

Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |

To convert from binary to decimal, follow these steps:

- Start result at 0
- Add the left-most digit to the result and multiply by 2
- Repeat the process at step 2 with the remaining digits; stop when all digits have been used

Example - convert 11110010_{2} to decimal:

- 0
- 1 + 0 = 1; 2 x 1 = 2
- 2 + 1 = 3; 3 x 2 = 6
- 6 + 1 = 7; 7 x 2 = 14
- 14 + 1 = 15; 15 x 2 = 30
- 30 + 0 = 30; 30 x 2 = 60
- 60 + 0 = 60; 60 x 2 = 120
- 120 + 1 = 121; 121 x 2 = 242
- 242 + 0 = 242

Binary | + Digit | = | × 2 | = |
---|---|---|---|---|

11110010 |
+ 1 | 1 | × 2 | 2 |

11110010 |
+ 1 | 3 | × 2 | 6 |

11110010 |
+ 1 | 7 | × 2 | 14 |

11110010 |
+ 1 | 15 | × 2 | 30 |

11110010 |
+ 0 | 30 | × 2 | 60 |

11110010 |
+ 0 | 60 | × 2 | 120 |

11110010 |
+ 1 | 121 | × 2 | 242 |

11110010 |
+ 0 | 242 |
- | - |

The conversion can also be performed by writing each binary digit as its value multiplied by the appropriate power of 2, then adding the products:

11110010_{2} |
= (1 × 2^{7}) + (1 × 2^{6}) + (1 × 2^{5}) + (1 × 2^{4}) + (0 × 2^{3}) + (0 × 2^{2}) + (1 × 2^{1}) + (0 × 2^{0}) |

= 128 + 64 + 32 + 16 + 0 + 0 + 2 + 0 | |

= 242_{10} |

Converting from octal to binary is the opposite of converting from binary to octal--just look up each octal digit to obtain the equivalent octet:

Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|---|---|

Binary | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |

263_{8} = 010 | 110 | 011 = 10110011_{2}

When converting from octal to hexadecimal, it may be easier to first convert to binary, then to hexadecimal. For example, to convert 263_{8} to hexadecimal:

263_{8} = 010 | 110 | 011 = 10110011_{2}

Group into quartets: 1011 | 0011 (drop or pad with zeros, as necessary), then convert quartets to hexadecimal digits.

Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |

1011 | 0011 = B | 3

263_{8} = 10110011_{2} = B3_{16}

To convert from octal to decimal, follow these steps:

- Start result at 0
- Add the left-most digit to the result and multiply by 8
- Repeat the process at step 2 with the remaining digits; stop when all digits have been used

Example - convert 263_{8} to decimal:

- 0
- 2 + 0 = 2; 2 × 8 = 16
- 6 + 16 = 22; 22 × 8 = 176
- 3 + 176 = 179

Octal | + Digit | = | × 8 | = |
---|---|---|---|---|

263 |
+ 2 | 2 | × 8 | 16 |

263 |
+ 6 | 22 | × 8 | 176 |

263 |
+ 3 | 179 |
- | - |

The conversion can also be performed by writing each octal digit as its value multiplied by the appropriate power of 8, then adding the products:

263_{8} |
= (2 × 8^{2}) + (6 × 8^{1}) + (3 × 8^{0}) |

= (2 × 64) + (6 × 8) + (3 × 1) | |

= 128 + 48 + 3 | |

= 179_{10} |

Converting from hexadecimal to binary is the opposite of converting binary to hexadecimal--just look up each hexadecimal digit to obtain the equivalent quartet; in this case, C51F_{16}:

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |

C = 1100; 5 = 0101; 1 = 0001; F = 1111

C51F_{16} = 1100010100011111_{2}

When converting from hexadecimal to octal, it may be easier to first convert to binary, then to octal. For example, to convert C51F16 into octal:

C51F_{16} = 1100010100011111_{2}

Group into octets (drop or pad with zeros, as necessary), then convert:

1100010100011111 = 001 | 100 | 010 | 100 | 011 | 111

Binary | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
---|---|---|---|---|---|---|---|---|

Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |

001 | 100 | 010 | 100 | 011 | 111_{2} = 1 | 4 | 2 | 4 | 3 | 7_{8}

C51F_{16} = 1100010100011111_{2} = 142437_{8}

Hexadecimal can be converted to decimal by substituting hexadecimal letter values with decimal values.

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

To convert C51F_{16} to decimal:

C51F_{16} = (C × 16^{3}) + (5 × 16^{2}) + (1 × 16^{1}) + (F × 16^{0})

C51F_{16} = (12 × 16^{3}) + (5 × 16^{2}) + (1 × 16^{1}) + (15 × 16^{0})

C51F_{16} = (12 × 4,096) + (5 × 256) + (1 × 16) + (15 × 1)

C51F_{16} = 49,152 + 1,280 + 16 + 15

C51F_{16} = 50,463_{10}

This table lists binary, octal, and hexadecimal values up to 15_{10}.

Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |