In what form is an IP address stored?
An IP address is stored and processed inside a computer in binary form (as bits), and the familiar notation with dots or colons is just a convenient representation for humans.
Short version: inside the system, an IP address is simply a number in binary format.
What this actually looks like
IPv4
For example, the IP address:
192.168.1.10
Inside a computer it is stored as 32 bits:
11000000 10101000 00000001 00001010
- each block is 8 bits (1 byte)
- 4 bytes together = 32 bits
IPv6
An IPv6 address:
2001:db8::1
Inside the system:
- 128 bits
- also in binary form
The hexadecimal notation (2001:db8) is just a short form for displaying bits.
Why we do not see the binary form
Because:
- the binary format is inconvenient to read
- humans easily make mistakes with bits
That is why these are used:
- decimal notation for IPv4
- hexadecimal notation for IPv6
But for the network and the OS:
- it is always a number
- always bits
An important point for an interview
- an IP address:
- is not a string
- is not text
- It is:
- a binary value
- on which operations are performed (masks, comparison, routing)
In short, for an interview
An IP address is stored and processed in binary form (as bits), and the familiar notation is just a convenient representation for humans.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.