LambdaLabTM
Computer Networks · Class 12 · Data Communication · IP Address
networksdata communication⏱️ 7 min read

IPv4 and IPv6

192.168.0.178 is a valid IP address. 192.168.0.278 is not. Nothing about them looks different — until you see how a computer stores each number. Then the rule explains itself.

1IPv4: four numbers

IPv4 address
An IPv4 (IP version 4) address is 32 bits long. It is written as four numbers separated by dots, and each number is from 0 to 255. For example, 192.168.0.178.

Why 255? Because a computer stores each of the four numbers in exactly 8 bits. Four numbers of 8 bits each makes 4 × 8 = 32 bits.

Eight bits are like eight lights, each worth a different amount: 128, 64, 32, 16, 8, 4, 2 and 1. Turn on the lights whose values add up to your number. With every light on you get 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 — the biggest number 8 bits can hold. 256 would need a ninth light, and there isn’t one.

An IPv4 address, bit by bit

Type an address or pick one. Each number gets eight lights. Drag sideways to turn.

Valid: four numbers, each from 0 to 255.
Exactly 4 numbers
Dots between them
Each number from 0 to 255

Press Count up past 255 and watch the first block. At 255 every light is on. One more, and the number no longer fits.

2Spotting an invalid address

An IPv4 address is valid only if all three of these are true:

  1. It has exactly four numbers.
  2. The numbers are separated by dots.
  3. Every number is from 0 to 255.

Check each number on its own. One number over 255, or one number too many, and the whole address is invalid.

1
Which of the following IP addresses is valid?
(A) 122.94.96.212  (B) 212.254.258.210  (C) 210.10.12.156.209  (D) 122.294.56.68CBSE compartment exam 2025
1 mark
Show the answer

(A) 122.94.96.212

  • (A) 122.94.96.212 Valid: four numbers, each from 0 to 255.
  • (B) 212.254.258.210 Not valid: “258” is more than 255.
  • (C) 210.10.12.156.209 It has 5 parts between the dots. An IPv4 address has exactly 4 numbers.
  • (D) 122.294.56.68 Not valid: “294” is more than 255.

3Running out of addresses

32 bits can make 232 = 4,294,967,296 different addresses — about 4.3 billion. That sounded like plenty when IPv4 was designed. But today phones, laptops, TVs, watches, cameras and even light bulbs join the Internet, and there are more of them than IPv4 has addresses.

4IPv6

IPv6 address
An IPv6 (IP version 6) address is 128 bits long. It is written as eight groups of hexadecimal digits separated by colons. For example, 2001:CDBA:0000:0000:0000:0000:3257:9652.

Hexadecimal digits are 0–9 and A–F, the same digits a MAC address uses. Each group has four of them. 128 bits give 2128 addresses: a number 39 digits long, about 3.4 × 1038. That is enough to give every device on Earth its own address many, many times over.

IPv4IPv6
Length32 bits128 bits
Written as4 decimal numbers (0–255)8 groups of 4 hexadecimal digits
Separated byDots ( . )Colons ( : )
Example192.168.0.1782001:CDBA:0000:0000:0000:0000:3257:9652
How many addresses2³² — about 4.3 billion2¹²⁸ — about 3.4 × 10³⁸

5Check yourself

Quick Check

Which of these IP addresses is NOT valid?

Quick Check

How many bits long is an IPv4 address?

Quick Check

Why was IPv6 introduced?