Not sure which lesson to do first? Find your level and get a plan →

CS Thinking · Systems, Networks & Impact · Grade 6-8

Packet

A small unit of data transmitted over a network, containing both the data payload (the actual information) and routing information in headers (source address, destination address, sequence number).


Quick Answer

A small unit of data transmitted over a network, containing both the data payload (the actual information) and routing information in headers (source address, destination address, sequence number). A photo or web page is too big to send in one go, so it is cut into many packets, often of at most about 1,500 bytes each. Every packet travels on its own, possibly by a different route, and the receiver uses the sequence numbers to put them back in order and to ask again for any that went missing.

Why This Matters

Packets are why a network can be shared: your video, your sister's game and a neighbour's email take turns on the same cable, packet by packet, instead of waiting for each other to finish. They also make the internet tough. If one router fails, the next packets go another way, and a lost packet is simply sent again. That explains video glitches, and why one big file becomes thousands of packets.

Intuitive Explanation

Suppose you must post a 300-page book to a friend, but the post office only takes envelopes of 10 pages. You split it into 30 envelopes. On each one you write your friend's address, your own address, and 'part 7 of 30'. The envelopes travel separately, some in different vans, and may arrive in any order. Your friend sorts them by part number, and if part 18 is missing, asks you to send it again. That is how packets work.

A digital packet has two parts. The header is the writing on the envelope: the source address, the destination address and a sequence number. The payload is the pages inside: one slice of the photo, message or web page. A 3 MB photo split into packets of 1,500 bytes needs about 2,000 of them. Routers read only the header to decide where each packet goes next; they never need to open the payload.

A packet is not the whole message, and it is not the connection. Losing one packet does not mean the connection is broken: the receiver notices the gap in sequence numbers and asks for that packet again, which takes a fraction of a second. A packet is also different from a protocol. The packet is the envelope; the protocol is the set of rules for how envelopes are addressed, numbered and re-sent.

Think of it like this. Sending packets is like moving house with a fleet of small cars instead of one giant truck: each box is labelled with the new address and 'box 12 of 40', each car takes whatever road is clear, and you unpack in number order at the other end. Unlike a lost box, a lost packet costs almost nothing: the sender just makes another copy.

Core idea. Packet switching means data is broken into pieces that can travel independently — making networks resilient and efficient.


When to Use

Think in packets when a question involves data split into pieces, pieces taking different routes, arriving out of order, or getting lost and re-sent, or asks how many pieces a file needs. Headers, addresses and sequence numbers are signals. If the question is about the rules for sending and checking packets, use Protocol; if it is about which devices are joined, use Network.

Tip. Ask: Is the question about one labeled piece of a larger message, carrying its own addresses and number, traveling on its own?

How to Recognize It

Before you reach for packets, check whether the problem is about the pieces data is cut into on its way across a network.

  1. Is a large file or message being split into many smaller pieces to send?

    Yes means packets. If the file is instead rewritten with fewer bits, that is Data Compression, which shrinks data rather than cutting it up.

  2. Does each piece need a source address, a destination address or a sequence number?

    Yes is the packet header at work. If the problem asks who decided those labels and what they mean, it points to Protocol.

  3. Do the pieces arrive out of order, late, or with some missing?

    Yes is normal packet behavior, handled by sequence numbers and resending. If the devices cannot reach each other at all, look at the Network instead.

  4. Is the problem about which devices are linked, rather than what travels between them?

    Yes points to Network. Packets are the traffic; the network is the roads they use.

Packet vs Protocol vs Network vs Data Compression

Packets, the rules for sending them, the links they cross, and shrinking files all show up when data travels. Ask whether you are looking at the pieces, the rules, the roads, or the size.

Packet

Meaning
A packet is a small piece of a message with a header holding its addresses and sequence number.
Key test
You can point to one piece and read where it is going.
Example
A 4,000-byte photo might travel as three packets, numbered 1, 2 and 3, each with the same destination address.

Protocol

Meaning
A protocol is the agreed set of rules for how packets are built, sent, checked and answered.
Key test
It describes rules every packet must follow, not one packet.
Example
TCP says the receiver must report what arrived, so the sender can resend lost packets.

Network

Meaning
A network is the set of linked devices and connections that packets travel across.
Key test
It is the roads and junctions, not the traffic on them.
Example
Packets from a school laptop pass through the school router, then the provider's routers.

Data Compression

Meaning
Data compression rewrites data using fewer bits, so there is less to store or send.
Key test
The total size goes down; splitting into packets never makes data smaller.
Example
Compressing a 6 MB text file to 2 MB means it needs about a third as many packets.

Formula & Notation

Worked Examples

Example 1 — Count the packets and fill the headers

Easy

A 6,000-byte message is sent in packets that each carry at most 1,500 bytes of data. How many packets are needed, and what goes in each header?
Show the steps and the answer
  1. Divide: 6,000 ÷ 1,500 = 4 packets.

    Each packet carries at most 1,500 bytes of the message, so the message has to be shared across 4.

  2. Give each header the source address, the destination address and a sequence number from 1 to 4.

    Routers use the destination address to forward the packet; the receiver uses the numbers to rebuild the message.

  3. Put bytes 1-1,500 in packet 1, bytes 1,501-3,000 in packet 2, bytes 3,001-4,500 in packet 3 and bytes 4,501-6,000 in packet 4.

    Each payload is one slice of the message, and its sequence number records which slice it is.

Answer: 4 packets. Each header holds the source address, the destination address and a sequence number from 1 to 4.

Takeaway: Divide the message size by the payload size to count packets; the header carries the addresses and the order.

Example 2 — Packets that arrive out of order

Standard

The 4 packets of a message leave in the order 1, 2, 3, 4. Packets 1 and 3 travel through a busy router in Paris; packets 2 and 4 go a faster way through Madrid. They arrive in the order 2, 4, 1, 3. Has the message been damaged? What does the receiver do?
Show the steps and the answer
  1. Recall that each packet is routed on its own.

    Routers send each packet the way that looks best at that moment, so packets from one message can take different paths.

  2. Read the sequence numbers that arrived: 2, 4, 1, 3.

    All four numbers are there, so nothing is missing; the packets only came out of order.

  3. Sort by sequence number into 1, 2, 3, 4, then join the payloads.

    The numbers in the headers, not the order of arrival, decide where each slice goes.

Answer: The message is not damaged. All 4 packets arrived, and the receiver sorts them back into the order 1, 2, 3, 4 before joining them.

Takeaway: Arrival order does not matter, because the sequence numbers put the message back together.

Example 3 — Find the mistake: one lost packet

Application

During a download of 2,000 packets, packet 857 is lost when a router gets overloaded. Leo says: 'A packet was lost, so the connection is broken and the whole download has to start again.' Find the mistake.
Show the steps and the answer
  1. See how the loss is noticed: the receiver has packets 856 and 858 but not 857.

    A gap in the sequence numbers shows exactly which packet is missing.

  2. Fill the gap: the receiver asks for packet 857 again, and the sender re-sends just that one.

    Protocols such as TCP are built to re-send lost packets, because losing a few is normal on busy networks.

  3. Count what is re-sent: 1 packet out of 2,000.

    The other 1,999 packets are kept, so the download carries on instead of restarting.

Answer: The connection is not broken. The receiver spots that number 857 is missing and asks for it again; only that 1 packet is re-sent, and the download finishes.

Takeaway: A lost packet is found by its missing sequence number and re-sent on its own.

Where You'll See It

  • Mailing a long book one chapter at a time

    A big message is split into packets like a book split into chapters; each packet is labeled with the destination address, sent separately, and reassembled in order at the other end.

  • A video call that briefly glitches

    During a call, audio and video travel as packets; if a few packets are lost or delayed, you get a momentary glitch, but the connection isn't broken — protocols often recover.

  • Many people streaming on the same Wi-Fi

    Packet switching lets everyone's data share the same network at once, interleaving packets, instead of one person having to wait for another to finish.

Common Mistakes

  1. The slip: All packets from one message travel the same route and arrive in order.

    Why it's tempting: It seems logical that pieces of one message would follow one another like a train.

    Instead: Packets are routed independently and can take different paths, so they may arrive out of order; the receiver uses sequence numbers in the headers to reassemble them correctly.

  2. The slip: Losing a packet means the whole connection is broken.

    Why it's tempting: A lost piece of data sounds like a failure of the connection.

    Instead: Packet loss is normal; protocols like TCP detect missing packets and retransmit them, so the connection keeps working.

  3. The slip: A packet is only the data being sent.

    Why it's tempting: The point of sending is the data, so the data feels like the whole packet.

    Instead: A packet carries both the data payload and header information (source address, destination address, sequence number) needed to route and reassemble it.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. A 6,000-byte photo is sent in packets that each carry at most 1,500 bytes of data. How many packets are needed?

    Hint: Divide the file size by the most each packet can hold.

  2. A 10,000-byte file is split into packets of at most 1,400 data bytes each. How many packets are needed, and how many data bytes are in the last one?

    Hint: Find how many full packets fit, then see what is left over.

  3. The packets of a message arrive in this order: #3 "no", #1 "Me", #4 "on", #2 "et at ". What message does the receiver rebuild?

    Hint: Sort the packets by their sequence numbers before joining them.

  4. Each packet has a 40-byte header plus up to 1,460 bytes of data. To send 2,920 bytes of data, how many packets are needed, and how many bytes travel in total?

    Hint: Count the packets first, then add a header for each one.

  5. Question A: why does each packet carry a sequence number? Question B: what rules do two computers agree on for resending a lost packet? Which question is about the packet itself, and which is about a protocol?

    Hint: One question is about what is written on the packet; the other is about agreed rules.

  6. A student says: "Packet #5 of my download never arrived, so the connection is broken and the download has failed." What is a better explanation?

    Hint: What can the receiver do when it notices a sequence number is missing?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Why not send a whole file in one big piece?

If one huge piece got damaged on the way, the whole file would have to be sent again. With packets, only the broken or missing piece is resent. Most network links also have a size limit, often about 1,500 bytes, so a big piece would not fit anyway. Small pieces let many users take turns on the same link, so no one waits for someone else's whole download to finish.

What happens if a packet gets lost for good?

It depends on the rules being used. For a file download, TCP notices the gap in the sequence numbers and the sender sends that packet again, so the file arrives complete. For a live video call, waiting would cause a freeze, so the app usually skips the lost packet and you see a brief blur or hear a tiny skip instead. Each app picks the trade-off that suits it.

How do packets know which way to go?

They don't choose; the routers do. Each router reads the destination address in the packet's header, looks it up in its routing table and sends the packet one hop closer. The next router does the same. A packet from your phone to a website may pass through 10 to 20 routers, each making its choice in a tiny fraction of a second.

Can someone read my packets on public Wi-Fi?

Anyone on the same network can, with the right tools, capture the packets passing by. The header must stay readable, because routers need the addresses. The data inside, though, is usually encrypted when the site uses HTTPS, so a snooper can see where your packets are going but not the password or message inside them. That is why the padlock in the address bar matters on public Wi-Fi.

Learning Path

← Before

NetworkInternet
Packet

You are here

Next →

Protocol
You should know Network and Internet: devices joined into networks, and networks joined across the world through routers. A packet adds the unit that actually travels: a small piece of data with a header holding addresses and a sequence number. Next, Protocol explains the agreed rules, such as TCP and IP, that number, route, check and re-send packets.

See Also