The below table visualizes how the decimal number 201 equals the hexadecimal number C9.

C | × | 16^{1} | = | 192 | |

+ | 9 | × | 16^{0} | = | 9 |

= | 201 |

Hexadecimal numbers are a positional numeral system with the base (or "radix") 16. Since there are only 10 different digits, alphabetical letters are used to reach 16 different digits:

Digit | Value |
---|---|

0 - 9 | 0 - 9 |

A | 10 |

B | 11 |

C | 12 |

D | 13 |

E | 14 |

F | 15 |

In the hexadecimal system, the number 16 is written as 10. Hexadecimal numbers are used frequently within computers and programming, since they represent data in a more human-readable way than binary digits do. One hexadecimal digit represents four binary digits, and thus two hexadecimal digits together describe one Byte. One Byte can represent all numbers between 00 and FF in the hexadecimal format. An example of when this is used in programming is color codes, for example in CSS on a website, where hexadecimal numbers can be used to define the three color components Red, Green and Blue (#RRGGBB). Some examples below:

Color | Hex code |
---|---|

#FF0000 | |

#00CC00 | |

#0000FF | |

#FF00FF | |

#FF8800 |

The hexadecimal system is built-in into many programming languages, and hexadecimal numbers are usually declared by starting the number with 0x. You can for example easily test in JavaScript by opening your web browser Console (normally by the F12 key) and type in 0x10. The browser will return the number 16. If you type in 0xFF, it will return 255, and so on.