# Hexadecimal A set of numbers that includes the letters a to f.

A hexadecimal number is a number that uses the letters A-F as well as the digits 0-9.

To illustrate:

decimal | hexadecimal |
---|---|

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 8 |

9 | 9 |

10 | A |

11 | B |

12 | C |

13 | D |

14 | E |

15 | F |

Then after reaching the *number* "F" you move on to using two digits like so:

decimal | hexadecimal |
---|---|

16 | 10 |

17 | 11 |

18 | 12 |

19 | 13 |

20 | 14 |

21 | 15 |

22 | 16 |

23 | 17 |

24 | 18 |

25 | 19 |

26 | 1A |

27 | 1B |

28 | 1C |

29 | 1D |

30 | 1E |

31 | 1F |

You can figure the rest out.

Anyway, these extra letters mean that you can represent bigger numbers with fewer characters in hexadecimal than you can using decimal.

Don't be put off by the lettersâ€¦ these are still numbers. You'll get used to it the more you use them. Besides, if you had to represent the numbers 10, 11, 12, 13, 14 and 15 using only one character, what else would you use?

Hexa = 6, Deci = 10. So _hexadeci_mal refers to the fact that there are 16 different characters in this numbering system.

When hexadecimal numbers are used in programming, they are often given the prefix "0x" (this is standard C++ notation, and bitcoin is written in C++, so there we go). So if you see a number like 0x1000 in some code, it means it's 1000 in hexadecimal. You can figure out how much that is in ~~normal~~ decimal.

## Converting

Here's how I figure out hexadecimal numbers it in my head:

Or if I want to get the correct answer, I'll use these tools:

Sometimes I like to use the command line:

```
# decimal to hexadecimal
echo "obase=16; 15" | bc
# hexadecimal to decimal
echo "ibase=16; F" | bc
```

#### Resources

You can read as much as you like about the hexadecimal numbering system, but you only really get a feel for it by using it (and regularly converting the numbers incorrectly in your head).

Nonetheless, here are some good resources.