What Is Hexadecimal?

How to count in the hexadecimal number system using 0–9 and A-F

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 base-10 system, and uses the 10 symbols from 0 through 9 to represent a value.

random green hexadecimal codes on a computer monitor
Jason Gayman / E+ / Getty Images

Where and Why Is Hexadecimal Used?

Most error codes and other values used inside a computer are represented in the hexadecimal format. For example, STOP codes that display on a Blue Screen of Death are always in hexadecimal format.

Programmers use hex 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 following values are equivalent:

  • Hex: F4240
  • Decimal: 1,000,000
  • Binary: 1111 0100 0010 0100 0000

Another place hexadecimal is used is as an HTML color code to express a specific color. 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.

Hexadecimal values up to 255 can be expressed in two digits, and HTML color codes use three sets of two digits, meaning 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 harder to read binary than hex.

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 helpful way to look at it:

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 102) + (N X 101)+ (N X 100)


...(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 163) + (N X 162) + (N X 161)+ (N X 160)

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.

Again, zero through nine in 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 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 in 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+3116, 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, without doing it manually. For example, entering 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, RapidTables, and JP Tools being just a few of them. Some of 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 (2F716), 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.

The Windows Registry is one place where you might run into hexadecimal values on a computer. Specifically, when dealing with DWORD and QWORD registry values.

  • Is hexadecimal a programming language?

    Hexadecimal code is technically a low-level programming language since programmers use it to translate binary code. The processor can't actually understand hexadecimal code. It's just a shorthand for programmers.

  • Who invented hexadecimal notation?

    Swedish American engineer John Williams Nystrom developed the hexadecimal notation system in 1859. Also known as the tonal system, Nystrom's original proposal had applications in various fields, including mathematics and metrology.

  • What is a Steam hex?

    If you use the Steam gaming service, your Steam hex is the same as your Steam ID, which is represented in hexadecimal.

Was this page helpful?