The hexadecimal number system, also called *base-16* or sometimes just *hex*, is a number system that uses 16 unique symbols to represent a particular value. Those symbols are 0-9 and A-F.

The number system that we use in daily life is called the *decimal*, or , system and uses the 10 symbols from 0 through 9 to represent a value.

### Where and Why is Hexadecimal Used?

Most error codes and other values used inside a computer are represented in the hexadecimal format.

For example, error codes called STOP codes, that display on a Blue Screen of Death, are always in hexadecimal format.

Programmers use hexadecimal numbers because their values are shorter than they would be if displayed in decimal, and *much *shorter than in binary, which uses only 0 and 1.

For example, the hexadecimal value *F4240* is equivalent to *1,000,000* in decimal and *1111 0100 0010 0100 0000* in binary.

Another place hexadecimal is used is as an HTML *color code* to express a specific color. For example, a web designer would use the hex value FF0000 to define the color red. This is broken down as *FF,00,00,* which defines the amount of red, green, and blue colors that should be used (*RRGGBB*); 255 red, 0 green, and 0 blue in this example.

The fact that hexadecimal values up to 255 can be expressed in two digits, and HTML color codes use three sets of two digits, it means there are over 16 million (255 x 255 x 255) possible colors that can be expressed in hexadecimal format, saving lots of space versus expressing them in another format like decimal.

Yes, binary is much simpler in some ways but it's also just much easier for us to read hexadecimal values than binary values.

### How To Count in Hexadecimal

Counting in hexadecimal format is easy so long as you remember that there are 16 characters that make up each set of numbers.

In decimal format, we all know that we count like this:

0,1,2,3,4,5,6,7,8,9,10,11,12,13,... adding a 1 before beginning the set of 10 numbers over again (i.e. the number 10).

In hexadecimal format however, we count like this, including all 16 numbers:

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10,11,12,13... again, adding a 1 before beginning the 16 number set over again.

Here are a few examples of some tricky hexadecimal "transitions" that you might find helpful:

...17, 18, 19, 1A, 1B...

...1E, 1F, 20, 21, 22...

...FD, FE, FF, 100, 101, 102...

### How To Manually Convert Hex Values

Adding hex values is very simple and is actually done in a very similar way to counting numbers in the decimal system.

A regular math problem like 14 + 12 can normally be done without writing anything down. Most of us can do that in our heads - it's 26. Here's one way to look at it that's helpful:

14 is broken down into 10 and 4 (10+4=14), while 12 is simplified as 10 and 2 (10+2=12). When added together, 10, 4, 10, and 2, equals 26.

When three digits are introduced, like 123, we know that we must look at all three places to understand what they really mean.

The 3 stands on its own because it's the last number. Take away the first two, and 3 is still 3. The 2 is multiplied by 10 because it's the second digit in the number, just like with the first example.

Again, take away the 1 from this 123, and you're left with 23, which is 20+3. The third number from the right (the 1) is taken times 10, twice (times 100). This means 123 turns into 100 + 20 + 3, or 123.

Here are two other ways to look at it:

...(**N** X 10^{2}) + (**N** X 10^{1})+ (**N **X 10^{0})

or...

...(**N** X 10 X 10) + (**N** X 10) + **N**

Plug each digit into the proper place in the formula from above to turn 123 into: 100 (**1 **X 10 X 10) + 20 (**2 **X 10) + **3**, or 100 + 20 + 3, which is 123.

The same is true if the number is in the thousands, like 1,234. The 1 is really 1 X 10 X 10 X 10, which makes it in the thousandth's place, 2 in the hundredths, and so on.

Hexadecimal is done in the exact same way but uses 16 instead of 10 because it's a base-16 system instead of base-10:

...(**N **X 16^{3}) + (**N **X 16^{2}) + (**N** X 16^{1})+ (**N **X 16^{0})

For example, say we have the problem 2F7 + C2C, and we want to know the decimal value of the answer. You must first convert the hexadecimal digits to decimal, and then simply add the numbers together like you would with the two examples above.

Like I explained already, zero through nine in both decimal and hex are the exact same, while numbers 10 through 15 are represented as the letters A through F.

The first number to the far right of the hex value 2F7 stands on its own, like in the decimal system, coming out to be 7. The next number to its left needs to be multiplied by 16, much like the second number from the 123 (the 2) above needed to be multiplied by 10 (2 X 10) to make the number 20. Finally, the third number from the right needs to be multiplied by 16, twice (which is 256), like a decimal-based number needs to be multiplied by 10, twice (or 100), when it has three digits.

Therefore, breaking up the **2F7** in our problem makes 512 (**2** X 16 X 16) + 240 (**F** [15] X 16) + **7**, which comes to 759. As you can see, F is 15 because of its position in the hex sequence (see *How To Count Hexadecimal* above) - it's the very last number out of the possible 16.

**C2C** is converted to decimal like this: 3,072 (**C **[12] X 16 X 16) + 32 (**2 **X 16) + **C** [12] = 3,116

Again, C is equal to 12 because it's the 12th value when you're counting from zero.

This means 2F7 + C2C is really 759 + 3,116, which is equal to 3,875.

While it's nice to know how to do this manually, it's of course much easier to work with hexadecimal values with a calculator or converter.

### Hex Converters & Calculators

A hexadecimal converter is useful if you want to translate hex to decimal, or decimal to hex, but don't want to do it manually. For example, entering the hex value 7FF into a converter will instantly tell you that the equivalent decimal value is 2,047.

There are lots of online hex converters that are really simple to use, BinaryHex Converter, SubnetOnline.com, and RapidTables being just a few of them. These sites let you convert not only hex to decimal (and vice versa) but also convert hex to and from binary, octal, ASCII, and others.

Hexadecimal calculators can be just as handy as a decimal system calculator, but for use with hexadecimal values. 7FF plus 7FF, for example, is FFE.

Math Warehouse's hex calculator supports combining number systems. One example would be adding a hex and binary value together, and then viewing the result in decimal format. It also supports octal.

EasyCalculation.com is an even easier calculator to use. It will subtract, divide, add, and multiply any two hex values you give it, and instantly show all the answers on the same page. It also shows the decimal equivalents next to the hex answers.

### More Information on Hexadecimal

The word *hexadecimal *is a combination of *hexa *(meaning 6) and *decimal* (10). Binary is base-2, octal is base-8, and decimal is of course base-10.

Hexadecimal values are sometimes written with the prefix "0x" (0x2F7) or with a subscript (2F7_{16}), but it doesn't change the value. In both of these examples, you could keep or drop the prefix or subscript and the decimal value would remain 759.