The Academy

Loading the search index…

Searches the academy on this device only.

Packets, protocols, bandwidth and latency

See how any message is cut into small packets, sent by different routes and put back together, why devices need shared rules called protocols, and why speed has two parts: bandwidth and latency.

25 minelementary

Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).

By the end of this lesson you will be able to

  • Explain with an analogy why data is sent as small packets rather than one long stream.
  • Describe a protocol as an agreed set of rules and give two examples.
  • Tell bandwidth from latency and say which one matters for a video call and which for a big download.
  • Convert a speed in megabits per second into a rough download time for a file.
  • Trace a packet through several hops on its way across the internet.

When a video buffers or a game lags, people say “the internet is slow”. But there are at least two different kinds of slow, and they have different causes and cures. This lesson explains how data actually travels and gives you the two words, bandwidth and latency, that let you describe a speed problem precisely.

Data travels in packets

Imagine posting a long book to a friend, but the post office only accepts small envelopes. You tear the book into numbered pages, put a few pages in each envelope, address every envelope and post them. The envelopes may take different routes and arrive in a different order. Your friend uses the page numbers to put the book back together.

That is how networks work. A message, a photo or a web page is cut into small pieces called packets. Each packet carries a header, which is the label on the envelope, and a piece of the actual data, called the payload. The header holds where the packet came from, where it is going, and its position in the sequence.

Diagram

A packet is a labelled envelope: header information plus a piece of your data.

192.168.1.23Fromsender's address
203.0.113.50Todestination address
3 of 8Orderplace in the message
…a piece of your photo…Payloadthe data itself
A packet is a labelled envelope: header information plus a piece of your data.
Read this figure as text

A packet split into labelled parts: from address, to address, order number and payload.

One packet shown as four parts from left to right. Part 1, From: 192.168.1.23, the sender's address (a made-up home address). Part 2, To: 203.0.113.50, the destination's address (a made-up documentation address). Part 3, Number: 3 of 8, which place this packet has in the whole message. Part 4, Payload: a piece of the photo or page being sent. The first three parts are the header, like the writing on an envelope; the payload is the contents.

Why not send everything in one go? There are three good reasons. Small pieces share the roads fairly, so one large download cannot block everyone else. If a piece is lost or damaged, only that piece needs to be sent again, not the whole file. And pieces can take different routes, so one broken cable does not stop the message.

The journey across the internet

A packet does not go straight from your laptop to a website. It passes through a chain of routers, each of which looks at the destination address and passes the packet to the next router that is closer. Each hand-over is called a Hop. A website on the other side of the world may be fifteen or more hops away.

Diagram

A packet hops from router to router until it reaches the server.

1234Your laptop192.168.1.23Home routerProvider routerExchangeWeb server203.0.113.50
A packet hops from router to router until it reaches the server.
Read this figure as text

A network diagram showing a laptop, home router, provider router, an exchange and a web server joined in a chain with numbered links.

Left to right, five points joined by numbered links. Your laptop (192.168.1.23) sends to link 1 your home router. Link 2 goes to your provider's router. Link 3 goes to a regional exchange router where many providers meet. Link 4 goes to the web server's provider router. Link 5 reaches the web server (203.0.113.50). Each router reads the destination address and forwards the packet to the next router. Every link is a hop; the replies come back along a similar path in the opposite direction.

Protocols: rules everyone agrees on

For the post to work, everyone must follow the same rules: where to write the address, what size the envelope is, what to do if a letter is lost. In computing, a set of agreed rules for communicating is a Protocol. Without shared protocols, a laptop made in one country could not talk to a server made in another.

Different protocols do different jobs, and they work together in layers, like the stages of posting a letter: writing it, addressing it and the lorry that carries it. You will meet the main ones in this path.

Some protocols you will meet, and the job each does
ProtocolJobEveryday example
IP (Internet Protocol)Addressing: gets packets to the right destinationEvery packet on the internet
TCPMakes sure all packets arrive and in orderLoading a web page or downloading a file
UDPSends packets quickly without checkingVideo calls and online games
HTTP / HTTPSAsking for and sending web pagesOpening a website
DNSTurning names into addressesTyping example.org

Bandwidth and latency: two kinds of speed

Bandwidth is how much data a connection can carry per second. Think of the width of a pipe: a wide pipe moves more water per second. It is measured in bits per second, usually megabits per second (Mbps). Latency is how long one packet takes to get there and back, like how long the first drop of water takes to travel the length of the pipe. It is measured in milliseconds (ms), thousandths of a second.

Diagram

Bandwidth is how much; latency is how long. They are independent.

BandwidthHow much per second
  • Like the width of a pipe
  • Measured in Mbps
  • Matters for downloads and streaming
  • More does not make one packet arrive sooner

A wide road, not a fast car.

LatencyHow long one trip takes
  • Like the length of the pipe
  • Measured in milliseconds (ms)
  • Matters for calls, games, remote desktops
  • Lower is better

The delay before anything starts.

Bandwidth is how much; latency is how long. They are independent.
Read this figure as text

Two columns explaining bandwidth with a wide pipe and latency with the delay for one packet.

Column 1, Bandwidth: how much data per second; like the width of a pipe; measured in megabits per second (Mbps); matters for large downloads, video streaming and uploading many photos; more bandwidth does not make a single packet arrive sooner. Column 2, Latency: how long one packet takes for a round trip; like the length of the pipe; measured in milliseconds (ms); matters for video calls, online games and anything interactive; low is better. A connection can have lots of bandwidth and high latency, or the reverse.

A real example: a satellite internet link might offer a wide pipe (good for downloading a film) but a long delay (poor for a fast game). A mobile signal in a crowded place might have plenty of bandwidth shared among too many users, so each person gets little.

Rough latency you might see (made-up typical figures, they vary widely)
ConnectionTypical round tripFeels like
Your laptop to your own router1 to 5 msInstant
Same country by cable10 to 40 msInstant
Another continent100 to 250 msSlight delay in calls
Satellite link500 ms or moreObvious pause in a conversation

Speed adverts quote bandwidth in megabits (small b). File sizes are in megabytes (capital B). A byte is eight bits, so divide the megabits by eight to get megabytes per second. A 100 Mbps line moves at best about 12.5 megabytes per second, so a 500 MB file takes roughly 40 seconds at best. Real speeds are lower because many devices share the line, and overheads use some of it.

Diagram

Best-case time to download a 500 MB file at different speeds.

5 Mbps
about 13 min
20 Mbps
about 3 min
100 Mbps
about 40 s
500 Mbps
about 8 s

Bar lengths use a logarithmic scale: each step along the bar is a multiple, not an equal amount.

Time in seconds, log scale. Best case only.

Best-case time to download a 500 MB file at different speeds.
Read this figure as text

A bar chart comparing how long it takes to download a 500 megabyte file at 5, 20, 100 and 500 megabits per second.

Download times for a 500 megabyte file, best case, on a log scale. At 5 Mbps: about 800 seconds, nearly 13 and a half minutes. At 20 Mbps: about 200 seconds, over 3 minutes. At 100 Mbps: about 40 seconds. At 500 Mbps: about 8 seconds. Real downloads are slower than these because of sharing and overheads. Each fivefold rise in speed cuts the time by about five.

Common mistakes

  • ✖ Instead of: Thinking more bandwidth always fixes lag in games and calls.

    ✔ Do this: Lag is mostly latency or lost packets. Extra bandwidth helps big downloads, not delay. Check Wi-Fi signal and distance first.

  • ✖ Instead of: Mixing up Mb (megabit) and MB (megabyte).

    ✔ Do this: Small b is bits, capital B is bytes. Divide megabits by eight to get megabytes.

  • ✖ Instead of: Believing the speed on the box is what you will always get.

    ✔ Do this: Advertised speeds are best case. Wi-Fi, other users, and the website's own server all lower what you see.

If something goes wrong

My download seems far slower than the speed my provider sells.
Check you are comparing the same unit: divide the advertised megabits by eight. Then test close to the router, with other devices paused. If it is still far lower on a cable, tell your provider the figures you measured.
Video calls freeze but downloads are fast.
That points at latency or lost packets rather than bandwidth. Move closer to the router or use a cable, close other streaming devices, and try again.

Key terms

Packet
A small piece of data sent across a network, labelled with where it came from and where it is going.
Protocol
A set of agreed rules that devices follow so they can understand each other.
Hop
One step of a packet's journey from one router to the next.
Bandwidth
The amount of data a connection can carry in a given time.
Latency
The time it takes for data to travel from one place to another and back.
Megabit (Mb)
A million bits; internet speeds are quoted in megabits per second, and eight bits make one byte.
Packet loss
When some packets never arrive, so data has to be sent again or is missing.

Practise it for real

Reading is not the same as being able to do it. Complete these on your own computer, then tick only what you have actually done. These ticks are your own honest record: nothing checks them for you.

Guided exercise

Work out download times

Without a real network, calculate the best-case time to download a 2 GB film (2,000 MB) on a 50 Mbps connection. Steps: divide 50 by 8 to get megabytes per second, then divide 2,000 by that figure. Repeat for a 200 Mbps line. Explain why your result is an optimistic best case.

You have succeeded when:
Independent challenge

Challenge: explain bandwidth and latency to a friend

Think of your own analogy, not pipes or roads, for bandwidth and latency. Explain which of the two matters more for a video call and which for downloading a long film, and why. Check that your friend can say back the difference.

You have succeeded when:

Knowledge check

6 questions. You need 80% to pass. Mistakes here are part of learning, and you can retry as often as you like.

  1. Question 1.Why is data cut into packets?
  2. Question 2.A protocol is an agreed set of rules that lets different devices communicate.
  3. Question 3.Kamau has a 300 Mbps connection and downloads films quickly, but in video calls there is a noticeable delay before the other person answers.Which measure is most likely the problem?
  4. Question 4.Match each term to its meaning.
  5. Question 5.Put these steps of a web request in order.
    1. Packets travel hop by hop through routers
    2. Packets arrive at the server
    3. The server puts the pieces back in order
    4. The message is cut into numbered packets
  6. Question 6.An advert says “100 Mbps”. About how many megabytes per second is that at best?

Summary

  • Data is cut into numbered packets, each with a header and a payload, and reassembled at the destination.
  • Packets travel hop by hop through routers.
  • A protocol is an agreed set of rules; IP, TCP, UDP, HTTP and DNS each do a job.
  • Bandwidth is how much per second (Mbps); latency is how long a round trip takes (ms).
  • Divide megabits by eight to get megabytes.

Checklist: can you do these?

Marking a lesson as read does not prove you can do it. Skills count as demonstrated when you pass the quiz (not yet) and complete the practical tasks (not yet).

Related lessons

References and further reading

Official sources for details that can change between versions.

On this page