# IPv6 - conerting between binary and hexadecimal

I just reading on IPv6 and you discussed converting between binary /decimal to Hexadecimal. You advised to split the 8 bits to 2 nibbles. When I look at the “chart” I’m confused how you come up with the 2 nibbles. From which end of the 8 bits do you write/align the first 4 bits? And how are you obtaining the decimal value. I understand how it works in IPv4 when converting the bit values to decimal but seems confusing when u split to 2 nibbles. thanks

We use four bits (a nibble) since that allows us to create all hexadecimal values:

• 0 - 0000
• 1 : 0001
• 2 : 0010
• 3 : 0011
• 4 : 0100
• 5 : 0101
• 6 : 0110
• 7 : 0111
• 8 : 1000
• 9 : 1001
• A : 1010
• B : 1011
• C : 1100
• D : 1101
• E : 1110
• F : 1111

For example, let’s say you want to convert the decimal value 212 to a hexadecimal value. First we have to convert it into binary:

212: 11010100

Now we can convert it from binary to hexadecimal. We’ll chop it into two nibbles:

1101 = D
0100 = 4

So the hexadecimal value is D4, often represented as 0xD4.

Does this help?

Thank you very much Rene. You are an awe-some instructor/teacher. Never seen anyone as dedicated and responsive to students. I figured how you go about this - Write the binary in nibbles starting from left to right and read the result Top-to-Bottom? Thanks - awe-some!!! Keep up the good work