Hexadecimal to Decimal and Binary

This topic is to discuss the following lesson:

How to convert IPV6 to IPV4 address?

We can’t, there is no such thing :slight_smile: IPv6 addresses are 128 bit and hexadecimal, IPv4 has 32 bit decimal addresses.

Typo: “The first nibble will be 8 + 4 = 12. The decimal value 7 is C in hexadecimal.”

Thanks Mathijs, it has been fixed.

Hi Rene,
“In the decimal system we count from 1-10, in the hexadecimal system we count from 1 – F”
should be “decimal 0-9, hexadecimal 0-F” :slight_smile:

Hi Georgi,

That is so true, especially for computers :wink: Just edited the post…thanks!

Rene

Hi Rene , I don’t understand how you convert nibbles binary to decimal,

Hello Emil

First of all let’s see the relationships between hex, and a nibble in binary. Each single hex digit corresponds to four bits in binary. But four bits in binary is considered a nibble. So a single hex digit corresponds to a nibble in binary. So when you are dealing with nibbles, it’s good to remember that you are dealing with four digits in binary, or one digit in hex.

If you know that, then it’s easy to convert from hex to decimal and decimal to hex. But when you convert from hex to binary, it’s usually easier to go from hex to decimal (which is trivial) to binary. The same when you go in the other direction, that is binary, to decimal to hex.

So let’s say you have the hex digit B. This corresponds to 11 in decimal. Which corresponds to 1011 (8+0+2+1=11) in binary, which is a nibble.

An example in the other direction could be 1110. This is 8+4+2=14 in decimal, which corresponds to E.

I hope this has been helpful!

Laz