Packets & Routing

Data travels the web as tiny chunks across independent paths, not as a single stream.

Internet3 min readConcept 1 of 6

What are Packets?

Data on the web doesn't travel as a single continuous stream. Instead, it is chopped up into tiny chunks called **packets**. Each packet is individually wrapped with destination information and navigates the vast network of routers independently, finding its own path to the destination where everything is stitched back together.

Why chunk data into packets?

Think of the internet like the global postal service. If you wanted to mail a massive book, you wouldn't send the entire book in one giant envelope. If it got lost, you'd lose everything.

Instead, tearing it into individual pages and mailing each one separately allows multiple computers to share the same physical lines (like cars sharing a highway). If a single packet gets lost in transit, you only need to retransmit that tiny piece, making the network far more efficient and resilient.

How Routing Works (TCP vs UDP)

The physical machines that pass these packets along are called **Routers**. Every packet has a header containing the destination IP address. When a router receives a packet, it reads the address and forwards it to the next closest router. Because the network is chaotic, packets from the same image might take completely different geographical routes and arrive out of order!

The protocol that manages this chunking and reassembly is called **TCP** (Transmission Control Protocol). TCP guarantees that every single packet arrives and is put back in the exact right order. If a packet gets lost, TCP notices the missing sequence number and asks the sender to resubmit just that one packet. This reliability makes TCP perfect for loading websites.

**UDP** (User Datagram Protocol) is the alternative. It sends packets as fast as possible but doesn't check if they arrive. If a packet is lost, it's gone forever. UDP is used for live video streams and multiplayer games where speed matters more than perfect accuracy.

The TCP Packet Swarm

Tap 'Send Payload' to watch a file break down into packets. Try tapping a packet to drop it and see how TCP tracks the missing data!

// Packets are routed independently // across the network. const downloadFile = () => { let received = []; onPacketReceived((packet) => { received.push(packet); // TCP handles reassembly if (received.length === totalSize) { assembleFile(received); } }); // TCP notices if a sequence number // is skipped and requests just that // missing packet again! };
TCP Progress
0 Received
Server
Client

Check yourself

Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.

  1. 1Why is data chopped into small packets instead of being sent as one huge file?
  2. 2What is the primary difference between TCP and UDP?
  3. 3If a single packet from a large image file gets lost during transmission, what happens?

Remember this

  • Data is broken into tiny packets to efficiently share network lines and recover from errors.
  • TCP is slow but perfectly reliable (used for the Web). UDP is fast but drops data (used for gaming/video).
  • Packets travel independently across decentralized routers and may arrive out of order.

Done with this concept?

Mark it complete to track your progress. No login needed.