Converting Hexadecimal to Decimal and Binary

The purpose of this post is to reference the CCNA Data Center (640-911) exam. This exam starts the conversation of IPv6 and since IPv6 is hexadecimal this post starts the talk about how we look at a hexadecimal values and learn how to convert them to binary and decimal. If you know subnetting skills then this won’t be that difficult. If you are new then check out The Wonders of Binary post as well as Part 1 and Part 2 of subnetting. Let’s get started!

Jumping right into it if we look at this hexadecimal value 0x56A we know it’s hexadecimal because the “0x” is the prefix for a hexadecimal number so we really don’t need to do anything with the “0x”. Let’s focus on the 56A value. So where do we start? Remember that 0-9 are normal decimal values so "5" actually means "5". We want to convert these values into binary. Followed by converting them into a decimal value. So what does the value 5 look like in binary? We then move  to the next digit "6" what does that look like in binary? Then the last value is "A", what does that look like in binary? Hint: A-F would be 10-15 in decimal. Reference chart below.

HEXADECIMAL DECIMAL BINARY
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
  • Looking at the value 56A we would want to combine all the single values into one binary string. (Example 5 in binary is: 0101, 6 in binary is: 0110, A in binary is: 1010) Combine these together and the the answer would be: 01010110101 (You can drop leading zeros) 1010110101
  • What does that value look like in decimal? Write it out and remember the power of 2s and always start with "1". The answer comes out as: 1,386.

Add up the 1s
Of course you can reverse engineer this if you were given a decimal value and needed to convert it into hexadecimal.

  • For example convert the following decimal 187 into hexadecimal. Write out 187 into binary so that answer looks like: 10111011.

  • You also want to split the binary string into equal parts, so the answer would be: 1011:1011 comparing the chart or doing this yourself convert this binary into hexadecimal. Since binary strings are the same our hexadecimal is: BB.

That's it! Understanding how to convert hex to decimal and back starts to get important when IPv6 shows up at the door. Although this is a fundamental level topic that's exactly why its important to understand it. Just like subnetting, I would use a calculator if you ever find yourself converting these values. It's always a good idea to double-check your work. However on the exam you don't have that pleasure so learning it the manual way is this only way. :)


Static Comments:

larry hynds -

this is fantastic information and i truly thank you for this. i am planning to take my eame this summer. if you have any more suggestion dor the exm i would apprechiate it. regards, storm


#### [Ryan](http://lewiryan.github.io/ciscoskills/ "ryan@lewiryan.github.io/ciscoskills") -

I'm glad this is going to help, Good Luck on the exam :)