IP Addressing Explained: Decimal, Binary, Hex, and Subnets
June 10, 2026 · 3 min read
IP Addressing Explained: Decimal, Binary, Hex, and Subnets
Every device on a network has an IP address — a numeric label that identifies it uniquely. Understanding how IP addresses are represented in different number bases, and how subnets carve them into ranges, unlocks a lot of networking knowledge.
The structure of an IPv4 address
An IPv4 address is a 32-bit number. It is written as four groups of decimal digits separated by dots — the "dotted decimal" notation:
192.168.1.10
Each group (called an octet) represents 8 bits and can range from 0 to 255.
| Notation | Example |
|---|---|
| Dotted decimal | 192.168.1.10 |
| Binary | 11000000.10101000.00000001.00001010 |
| Hexadecimal | 0xC0A8010A |
| Unsigned 32-bit integer | 3232235786 |
All four represent the same address. Converting between them is straightforward:
Decimal to binary
Split the address into four octets and convert each 0–255 decimal to an 8-bit binary number:
| Octet | Decimal | Binary |
|---|---|---|
| 1 | 192 | 11000000 |
| 2 | 168 | 10101000 |
| 3 | 1 | 00000001 |
| 4 | 10 | 00001010 |
Full binary: 11000000101010000000000100001010
Decimal to hexadecimal
Convert each decimal octet to a 2-digit hex value:
| Octet | Decimal | Hex |
|---|---|---|
| 1 | 192 | C0 |
| 2 | 168 | A8 |
| 3 | 1 | 01 |
| 4 | 10 | 0A |
Full hex: C0A8010A (often written with 0x prefix: 0xC0A8010A)
IP to integer (and back)
To convert to a single 32-bit unsigned integer, treat the full binary string as a number:
11000000 10101000 00000001 00001010
= (192 × 16777216) + (168 × 65536) + (1 × 256) + 10
= 3221225472 + 11010048 + 256 + 10
= 3232235786
To go back, use bitwise shifts:
octet1 = (3232235786 >> 24) & 0xFF → 192
octet2 = (3232235786 >> 16) & 0xFF → 168
octet3 = (3232235786 >> 8) & 0xFF → 1
octet4 = 3232235786 & 0xFF → 10
Use the IP to Decimal Converter and Decimal to IP Converter for quick conversions.
Private and special address ranges
Not all IP addresses are routable on the public internet. RFC 1918 reserves three private ranges:
| Range | CIDR | Usage |
|---|---|---|
10.0.0.0 – 10.255.255.255 |
10.0.0.0/8 |
Large private networks |
172.16.0.0 – 172.31.255.255 |
172.16.0.0/12 |
Medium private networks |
192.168.0.0 – 192.168.255.255 |
192.168.0.0/16 |
Home and small office LANs |
Other special ranges:
| Address | Purpose |
|---|---|
127.0.0.1 |
Loopback (localhost) |
0.0.0.0 |
Unspecified / "any" address |
169.254.0.0/16 |
Link-local / APIPA (no DHCP) |
224.0.0.0/4 |
Multicast |
255.255.255.255 |
Limited broadcast |
CIDR notation and subnets
CIDR (Classless Inter-Domain Routing) notation appends a /prefix to an IP address to describe a network range:
192.168.1.0/24
The /24 means the first 24 bits are the network portion; the remaining 8 bits are host addresses. /24 yields 2⁸ = 256 addresses (254 usable — one for the network address, one for broadcast).
| Prefix | Subnet mask | Hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /24 | 255.255.255.0 | 254 |
| /28 | 255.255.255.240 | 14 |
| /30 | 255.255.255.252 | 2 |
| /32 | 255.255.255.255 | 1 (single host) |
IPv6 in brief
IPv6 uses 128-bit addresses written as eight groups of four hex digits:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Consecutive all-zero groups can be collapsed to :: (once per address):
2001:db8:85a3::8a2e:370:7334
IPv6 eliminates the need for NAT and provides ~3.4 × 10³⁸ unique addresses — enough for every atom on Earth to have billions of addresses.
Quick reference
| Need | Tool |
|---|---|
| Convert IP ↔ decimal | IP to Decimal, Decimal to IP |
| Look up an IP's geolocation | IP Address Lookup |
| Calculate subnet ranges | CIDR Calculator |