Communication Networks · Visualized

Subnetting & CIDR

Addressing & Names

How devices get numbers, find each other on the LAN, and turn human-readable names into addresses.

7 interactive subtopics — each one animated, step-through and explained.

Subnetting & CIDR

Addressing & Names

Subnetting carves one network into several smaller ones by borrowing bits from the host part of the address. CIDR (Classless Inter-Domain Routing) generalises the idea: the /n suffix — not an old class A/B/C letter — defines the split, so address blocks can be sized to actual need. Every borrowed bit doubles the number of subnets and halves the hosts per subnet; the router uses the mask to tell neighbouring subnets apart.

How Subnetting & CIDR Works

  1. Start from a block, say 192.168.1.0/24, with 8 host bits.
  2. Borrow 1 bit → /25: two subnets (…0 and …128), 126 usable hosts each.
  3. Borrow 2 bits → /26: four subnets (…0, …64, …128, …192), 62 usable hosts each.
  4. Per subnet: host bits all-0 = network address, all-1 = broadcast; everything between is assignable.
  5. Routers AND each destination with the mask — the resulting network ID picks the outgoing interface.

Subnetting & CIDR Worked Example

Try it: Toggle the prefix and watch one /24 split into 1, 2, 4 or 8 subnets.

At /26 the block divides into four quarters of 62 hosts. 192.168.1.130 lives in the …128 quarter — AND its address with 255.255.255.192 and the network ID 192.168.1.128 appears. That single AND-operation is how routers make every forwarding decision.

Prefix4 subnets × 62 hosts
192.168.1.0/24 — last octet decides the split:11000000← borrowed192.168.1.0/26hosts 192.168.1.1 – 192.168.1.63bc .63192.168.1.64/26hosts 192.168.1.65 – 192.168.1.127bc .127192.168.1.128/26hosts 192.168.1.129 – 192.168.1.191bc .191192.168.1.192/26hosts 192.168.1.193 – 192.168.1.255bc .255
borrowed (subnet) bits host bits network ID
Stage 1 / 4
Start from 192.168.1.0/24 — 254 usable hosts in one flat network. Set the prefix to borrow bits.

Subnetting & CIDR: Key Facts to Remember

Formulasubnets = 2^borrowed · hosts = 2^hostbits − 2 (network + broadcast)
Route aggregationCIDR lets ISPs advertise one 10.0.0.0/8 instead of 65 thousand class C routes
VLSMdifferent mask lengths per subnet — a /30 for a router link, a /24 for the office LAN

Recommended resourcesAffiliate links · may earn us a commission

Recommended for learners

Cloud hosting for side projectsShip the portfolio project that gets you hired — free credits for new accounts.Claim credits Pro code editor & AI assistantWrite, debug and explain code faster while you practice the patterns here.Try it free Structured coding coursesVideo courses that pair well with visual practice — pick one language and go deep.Browse courses

See how packets really travel

Networks are built on the structures and algorithms you can watch step by step — queues, trees, and routing algorithms.