Now that you understand binary, let’s move onto hexadecimal, or base 16. This is the numbering system most programmers use, because it translates easily to and from binary. Also, 2 hexadecimal digits make up a byte, or 8 bits.

How do we have 16 digits? Simple, hexadecimal uses the digits 0-9 and the letter A-F. 0-9 is the same in hexadecimal as decimal. The digits A-F in hexadecimal are 10-15 in decimal. Here is a conversion chart of single digit hexadecimal:

Hexadecimal | Binary | Decimal |
---|---|---|

0_{16} | 0_{2} | 0_{10} |

1_{16} | 1_{2} | 1_{10} |

2_{16} | 10_{2} | 2_{10} |

3_{16} | 11_{2} | 3_{10} |

4_{16} | 100_{2} | 4_{10} |

5_{16} | 101_{2} | 5_{10} |

6_{16} | 110_{2} | 6_{10} |

7_{16} | 111_{2} | 7_{10} |

8_{16} | 1000_{2} | 8_{10} |

9_{16} | 1001_{2} | 9_{10} |

A_{16} | 1010_{2} | 10_{10} |

B_{16} | 1011_{2} | 11_{10} |

C_{16} | 1100_{2} | 12_{10} |

D_{16} | 1101_{2} | 13_{10} |

E_{16} | 1110_{2} | 14_{10} |

F_{16} | 1111_{2} | 15_{10} |

Hexadecimal, sometimes simply called hex, is very easy to translate to and from binary. This is because each digit in hex is 4 digits in binary. All you have to do is replace the hexadecimal digit with the binary equivalent. For instance, the number FF_{16} is 11111111_{2}.

Converting a binary number to hex works just slightly different. When you convert a number from hex to binary, you can work from left to right or right to left. When you convert a number from binary to hex, you must work from right to left. This is because a binary number might not be the correct length to work from left to right.

That’s all for today, check back Friday for Octal, or base 8. Here’s some homework:

Convert the following hexadecimal numbers to binary and decimal:

A2_{16}

FFFFFF_{16}

100_{16}

CCCCCC_{16}

A2B_{16}

FA6F_{16}

123_{16}

321_{16}

1000_{16}

10000_{16}