7

Why are ethernet- / mac-addresses in hex (and have 48 bits) and ip numbers in decimals (and have 32 bits)? Does that have historical or practical reasons?

user44840
  • 71
  • 1
  • 2
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer. – Ron Maupin Jan 03 '21 at 21:58

2 Answers2

11

Different people design different protocols. Ethernet can transport more than IP (IPX was quite common 15-20 years ago and also used hex in it's addresses. To be more precise: The local part of an IPX address was the MAC address). IP on the other hand can run without using Ethernet as Layer-2 protocol.

Somehow Ethernet (and MAC addressing) became the dominant layer-2 protocol and IPv4 the dominant layer-3 Protocol. With IPv6 we have HEX back in our IP(v6) addresses .

2

Jens has a great technical answer (and got an upvote from me) but the other aspect is human readability, because as humans we were always intended to be the "things" that would need to understand these addresses at a higher layer of consciousness that machines do not possess. Conveying a 48-bit address in decimal would be less efficient than conveying a 32-bit address in decimal (in the context of human readability; everything is binary to a router/switch/whatever).

For example, the number space that's able to be expressed by 32 bits lends itself nicely to carving that space up into evenly-sized chunks (the chunks here are bytes, or octets) of 8 bits each, and you have a maximum decimal "capacity" of 255 for each one of those chunks. This would naturally lead to representing those addresses in the dotted decimal format, because you won't ever have an octet that's longer than 3 decimal digits.

A MAC address is different. Hexadecimal is more efficient here because you can express more with less, and you are again limiting the scope of the length of digits to compensate for the larger address space. There are 6 octets in a 48-bit address, and each hexadecimal digit is 4 bits; you won't have any octet in a 48-bit address be longer than two hexadecimal digits.

aa:d3:ad:be:ef:aa

is easier (more efficient) to read, write and interpret than

170:211:173:190:239:170
John Jensen
  • 8,997
  • 4
  • 29
  • 47
  • 1
    You get the same range from hex, and it's always safe to represent each octet as 2 hex digits. So instead of 192.168.1.1 you could have had C0.A8.01.01. Much easier to read and remember. You'd also be able to use pronounceable mnemonics, like maybe the most popular home network prefix could have come to be colloquially known as "koate." Finally, with hex there would be no invalid representations possible, i.e. there's no hex equivalent to 256.310.001.999. ffffffff is the maximum representable number AND the highest IP address. Hex is just way more efficient and clear than decimal. Too bad :/ – Justin Force Jun 16 '16 at 20:45
  • 1
    To be clear, I like your response. But it really just seems to make the case that we should have used hexadecimal for IPv4 addresses in the first place. :D – Justin Force Jun 16 '16 at 23:43