An IP address (Internet Protocol address) is a unique numerical label assigned to every device connected to a network. It serves two purposes: identifying the device and specifying its location on the network so data can be routed to it.
TL;DR — An IP address is a unique identifier for a device on a network, similar to a postal address for a building. IPv4 addresses are 32-bit numbers written as four decimal octets (e.g., 192.168.1.1), supporting ~4.3 billion addresses. IPv6 addresses are 128-bit numbers written in hexadecimal (e.g., 2001:0db8::1), supporting 340 undecillion addresses. Every packet of data traveling across the internet carries a source IP and a destination IP so routers know where to send it.
What does an IP address do?
Every device that sends or receives data over a network — a laptop, server, smartphone, router, or IoT sensor — must have an IP address. Without one, the network has no way to deliver packets to that device.
IP addresses serve two specific functions defined by RFC 791:
- Host identification — uniquely identifies a specific device (or interface) on a network
- Location addressing — encodes enough information for routers to find a path to the device
When you load a website, your browser sends a request from your IP address to the server’s IP address. Every router along the path reads the destination IP and decides which direction to forward the packet.
How IP addresses are structured
IPv4 address structure
An IPv4 address is a 32-bit binary number, written as four decimal numbers (octets) separated by dots.
Format: W.X.Y.Z Example: 203.0.113.45
Each octet ranges from 0 to 255. In binary, 203.0.113.45 is:
11001011.00000000.01110001.00101101The address is split into two parts:
- Network portion — identifies which network the device belongs to
- Host portion — identifies the specific device within that network
The split between network and host is defined by the subnet mask (e.g., /24 means the first 24 bits are the network, leaving 8 bits for hosts — up to 254 usable devices).
IPv6 address structure
An IPv6 address is a 128-bit number written as eight groups of four hexadecimal digits separated by colons.
Format: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 Shortened: 2001:db8:85a3::8a2e:370:7334
Consecutive groups of zeros can be collapsed to :: (once per address).
IPv6 supports 2¹²⁸ addresses — approximately 340 undecillion (3.4 × 10³⁸). That is enough to assign billions of IP addresses to every person on Earth.
IPv4 vs IPv6: key differences
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address length | 32 bits | 128 bits |
| Address space | ~4.3 billion | ~340 undecillion |
| Notation | Decimal (192.168.1.1) | Hexadecimal (2001:db8::1) |
| Header size | 20–60 bytes | Fixed 40 bytes |
| NAT required | Yes (addresses exhausted) | No |
| Built-in security | No (IPsec optional) | IPsec mandatory |
| Broadcast | Yes | No (multicast instead) |
| Auto-configuration | DHCP required | SLAAC built-in |
| Adoption (2026) | ~60% of internet traffic | ~40% of internet traffic |
IPv4 address exhaustion was declared by IANA in 2011. The internet has been running on IPv4 through NAT (Network Address Translation) and address recycling ever since. IPv6 adoption reached 40% of global internet traffic by 2026 according to Google’s IPv6 statistics.
Types of IP addresses
Public vs private IP addresses
| Type | Range | Routable on internet | Assigned by |
|---|---|---|---|
| Public | Everything outside RFC 1918 | Yes | ISP / RIR |
| Private (Class A) | 10.0.0.0/8 | No | Network admin |
| Private (Class B) | 172.16.0.0/12 | No | Network admin |
| Private (Class C) | 192.168.0.0/16 | No | Network admin |
Private IP addresses are used inside home networks, corporate LANs, and data centers. A router with NAT translates private addresses to a public IP when traffic leaves the network.
Static vs dynamic IP addresses
- Static IP — manually configured, never changes. Used for servers, DNS records, and infrastructure that must be consistently reachable.
- Dynamic IP — assigned by DHCP each time a device connects. Used for most end-user devices (laptops, phones).
Special IP address ranges
| Range | Purpose |
|---|---|
| 127.0.0.0/8 | Loopback (localhost) — traffic stays on the same device |
| 169.254.0.0/16 | Link-local — used when DHCP fails (APIPA) |
| 0.0.0.0/8 | Unspecified — used in routing to mean “any address” |
| 255.255.255.255 | Limited broadcast |
| 100.64.0.0/10 | Carrier-grade NAT (RFC 6598) |
How IP addresses are assigned
IP addresses are not random. They are allocated through a hierarchy:
- IANA (Internet Assigned Numbers Authority) — manages the global IP address space
- RIRs (Regional Internet Registries) — five regional bodies (ARIN, RIPE NCC, APNIC, LACNIC, AFRINIC) receive large blocks from IANA and distribute to ISPs and organizations
- ISPs — assign public IPs to customers
- DHCP servers — assign private IPs dynamically within a network
How routers use IP addresses
When a packet travels from source to destination, each router along the path:
- Reads the destination IP address in the packet header
- Looks up the destination in its routing table
- Forwards the packet to the next hop (the next router closer to the destination)
This process repeats at every router until the packet reaches its destination. The path is not pre-determined — routers make independent decisions at each hop based on their routing tables.
Routing tables are built and maintained by routing protocols such as BGP (between autonomous systems) and OSPF (within a network).
IP addresses and the OSI model
IP addressing operates at Layer 3 (Network layer) of the OSI model. This is distinct from:
- Layer 2 (Data Link) — MAC addresses identify devices on the same local network segment
- Layer 4 (Transport) — Port numbers identify specific applications or services on a device
A full network address for a specific application is: IP address + Port number (e.g., 203.0.113.45:443 for HTTPS).
How to find your IP address
On Linux/macOS:
ip addr show # shows all interfaces with IP addressescurl ifconfig.me # shows your public IP addressOn Windows:
ipconfig # shows local IP addressesPublic IP: Visit any IP lookup service or run curl ifconfig.me from a terminal.
Frequently asked questions
What is an IP address? An IP address is a unique numerical label assigned to every device on a network. It identifies the device and provides location information so routers can deliver data packets to it. IPv4 addresses are 32-bit numbers (e.g., 192.168.1.1); IPv6 addresses are 128-bit numbers (e.g., 2001:db8::1).
What is the difference between a public and private IP address? A public IP address is globally unique and routable on the internet, assigned by an ISP. A private IP address (ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) is used inside local networks and is not directly reachable from the internet. A router uses NAT to translate between private and public addresses.
What is the difference between IPv4 and IPv6? IPv4 uses 32-bit addresses (4.3 billion total); IPv6 uses 128-bit addresses (340 undecillion total). IPv4 addresses are nearly exhausted — IANA declared exhaustion in 2011. IPv6 eliminates the need for NAT, has a simpler fixed-size header, and includes built-in IPsec support. As of 2026, approximately 40% of global internet traffic uses IPv6.
What is a loopback IP address? The loopback address (127.0.0.1 in IPv4, ::1 in IPv6) routes traffic back to the same device without sending it over the network. It is used to test network software locally. Any address in the 127.0.0.0/8 range routes to localhost.
Can two devices have the same IP address? Two devices cannot share the same IP address on the same network simultaneously — this causes an IP conflict and breaks connectivity for one or both devices. On different networks separated by NAT, devices can share the same private IP address (e.g., every home router assigns 192.168.1.1 to itself).
What is a static IP address and when should I use one? A static IP address is manually configured and does not change. Use static IPs for servers, printers, network equipment, and any device that must be consistently reachable at the same address. DNS records, firewall rules, and monitoring configurations depend on address stability.
How does DHCP assign IP addresses? DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to devices when they connect to a network. The DHCP server maintains a pool of available addresses, leases one to each device for a defined period, and reclaims it when the lease expires. DHCP also provides subnet mask, default gateway, and DNS server information.
What layer of the OSI model do IP addresses operate at? IP addresses operate at Layer 3, the Network layer of the OSI model. Layer 3 is responsible for logical addressing and routing packets between different networks. This is distinct from Layer 2 (MAC addresses, same-network delivery) and Layer 4 (port numbers, application identification).