Hex to Dotted Decimal to Binary conversion explained, and other good info to know for exam day about Hex!

hex_converseion_template

Above is a Hex Conversion Template from an INE video I am watching on conversion, and I really dig the design to full explain it so I am using the same template and wanted to cite INE as the creator of the design (I think?) and for the information on conversion.

It is actually used to go descend from Hex at the top to Dotted Decimal in the middle, and finally binary towards the bottom portion. It is used for converting a single Hextet.

Speaking of Hextets, IPv4 has 4 “Octets”, IPv6 has 8 “Hextets” which are also called a “Sexdecet” or “Quartet” in mathematical technical terminology. I wanted to mention that in case you get an exam question like Which is not a valid term for a hexidecimal segment?

So each Hextet is made up of 16 bits, meaning each Hex character in a Hextet is made up of 4 bits, as the max value you will have will be 15 (F) so you only use 4 binary bits per character.

So before I give a visual example and explain, lets solidify that 0-9 will equal 0-9 when converting to dotted decimal, and A-F are 10-15 with A=10 / B=11 / C=12 / D=13 / E=14 / F=15.

So lets take a look at a completed template and we’ll break down whats happening:

hex_converseion_ex1

So it fairly obvious the top 2 columns, however the bottom was a little mysterious to me at first. What it is is basically the second half of an octet, whereas when I count an octet I start from the left and read out loud “128, 64, 32, 16, 8, 4, 2, 1” to make up the 16 bits.

As mentioned about, the max value for a Hex character is 15, so we will only use the right most 4 bits to break the Hex value down to Binary, but unless your good first you will generally have to break it down to its Dotted Decimal value first, then go through the binary conversion process.

Here is another example of the process with some more random characters:

hex_converseion_ex2

Now to do this conversion backwards, you do the same thing, you’d just work the chart from the bottom up or start with 4 binary bits at the top, however one important thing to note when arriving at your final Hex answers is if the decimal is 10-15 it will be A-F not 10-15 so be very careful (and practice) to avoid that mistake!

Let me write out a quick demonstration here without the fancy schmancy template:

Binary ->       1110 | 0101 | 1101 | 0110 | 0001 | 1001 | 1111 | 1110 | 0001 | 1010 | 1110 | 0011

Decimal  ->     14  |    5     |    13   |   6     |    1     |   9    |   15  |   14  |    1     |    10   |   14    |    3

Hex ->               E   |   5    |    D    |  6     |     1    |    9     |   F    |    E   |     1    |    A    |    E     |    3

Hex string:        E5D6:19FE:1AE3

I hope the formatting of WordPress doens’t goof that up, but I added pipes between all the binary sets / numbers / characters for clarity of what corresponds with what.

And that is it for Hex conversion, I think I got a very odd way of doing it before which made it difficult to ever remember, because this seems straight forward and easier. Ok, enough break time from IPv6, back to the CCNP grind! 🙂

 

3 thoughts on “Hex to Dotted Decimal to Binary conversion explained, and other good info to know for exam day about Hex!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s