IPv4 Packet Header

Hello Abdul

The Header Length is a “4 bit field that tells us the length of the IP header in 32 bit increments”.

To understand this statement more clearly, let’s use 4-byte increments which is the same as 32-bit increments since 4 bytes = 32 bits.

  • A value of 1 in the Header Length gives us a length of 4 bytes
  • A value of 2 in the Header Length gives us a length of 8 bytes
  • A value of 3 in the Header Length gives us a length of 12 bytes
  • A value of 4 in the Header Length gives us a length of 16 bytes
  • A value of 5 in the Header Length gives us a length of 20 bytes

Because the length of the IP header cannot be smaller than 20 bytes, the smallest value of the Header Length is 5. It can be larger of course, like so:

  • A value of 6 in the Header Length gives us a length of 24 bytes
  • A value of 7 in the Header Length gives us a length of 28 bytes
  • A value of 8 in the Header Length gives us a length of 32 bytes
  • A value of 14 in the Header Length gives us a length of 56 bytes
  • A value of 15 in the Header Length gives us a length of 60 bytes

So essentially, to get the header length in bytes, we multiply the value of the Header Length by 4.

Does that make sense?

I hope this has been helpful!

Laz