← WA Computer Science ATAR Unit 1

Encapsulation and decapsulation through the layers

Each layer on the sender adds its own header (and sometimes a trailer) as data moves down the layers. The receiver removes them in reverse order, which is called decapsulation.

Understanding Encapsulation and decapsulation through the layers in WA Computer Science ATAR Unit 1

What it does: Encapsulation at the transport layer wraps the application data with a header, which forms a segment. Only the frame has both a header and a trailer. The trailer marks the end of the frame and holds error-checking data. Decapsulation is the reverse process at the receiver. Each layer removes its own header and passes the rest up. The frame is the outermost wrapper added by the sender, so the receiver must strip it first before reaching the packet and segment.

Common mistakes: The Transport layer builds the segment, so it adds the TCP header, not the IP header. It should be segment = TCP_header + data. The IP header is added at the next layer down. Each layer wraps the unit from the layer above. The frame must wrap the packet, so it should be frame = MAC_header + packet. Skipping the packet would lose the IP header.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 315–470) and word search (Modules 100–470).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
As data moves down the layers on the sender's device, what does each layer do to it?
Adds its own header (encapsulation)Removes the header added by the layer above
Matches
Receiver removes the frame header last, after the TCP header
↓
Decapsulation happens in reverse order, so the frame header is removed first, not last.
Applying
Meanings
Term
encapsulation
Meaning
Each layer on the sender adds its own header (and sometimes a trailer) as data moves down the layers. The receiver removes them in reverse order, which is called decapsulation.
Practice
SENDER
Testing
Gaps
Transport layer: data + header =
Check Answer
Spots
1data = 'Hello'
2segment = IP_header + data

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Giraffe' badge — High Perspective, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. As data moves down the layers on the sender's device, what does each layer do to it?
A. Removes the header added by the layer above
B. Adds its own header (encapsulation) ✓
Encapsulation means each layer wraps the data it receives from the layer above with its own header. Removing headers happens at the receiver.
2. Which describes decapsulation?
A. The receiver strips off each layer's header in reverse order ✓
B. The sender adds headers from the bottom layer to the top
Decapsulation is the reverse process at the receiver. Each layer removes its own header and passes the rest up.
3. In the TCP/IP model, what is the data unit called after the Transport layer (TCP) adds its header?
A. Frame
B. Segment ✓
The Transport layer adds a TCP header to make a segment. A frame is made later at the Network Access layer.
4. What does the Internet layer produce when it adds an IP header to a segment?
A. A packet ✓
B. A frame
The IP header, with source and destination IP addresses, turns the segment into a packet.
5. Which layer adds a header and a trailer to create a frame?
A. Network Access (data link) ✓
B. Transport
The Network Access layer wraps the packet with a header (MAC addresses) and a trailer (error check) to make a frame.

Match the Pairs

Application data -> Segment -> Packet -> Frame → The order data is encapsulated as it moves down the layers on the sender
Frame -> Packet -> Segment -> Application data → The order data is decapsulated as it moves up the layers on the receiver
The transport layer adds a TCP header containing port numbers to the data, creating a segment → Segment = TCP header + Data
The network interface layer adds a header and a trailer around the packet, creating a frame → Frame = Frame header + Packet + Frame trailer
Receiver removes the frame header last, after the TCP header → Decapsulation happens in reverse order, so the frame header is removed first, not last.
Sender: Frame -> Packet -> Segment -> Data → This shows the wrong direction. Encapsulation starts with the data and adds headers on the way down, so the frame is made last.

Key Term

encapsulation
Each layer on the sender adds its own header (and sometimes a trailer) as data moves down the layers. The receiver removes them in reverse order, which is called decapsulation.

Fill in the Blanks

1. Transport layer: data + header = segment
Hint: Type the name of the data unit the transport layer creates
2. Network layer: segment + header = packet
Hint: Type the name of the data unit the network layer creates
3. frame = header + packet + trailer
Hint: Type the part the data link layer adds at the end of the frame
4. Receiver removes headers in reverse order
Hint: Type the word that describes the order the receiver peels off the headers
5. Receiver: frame -> packet -> segment -> data
Hint: Type the data unit that sits between the packet and the original data when decapsulating

Spot the Error

Question 1
A data = 'Hello'
B segment = IP_header + data
C packet = IP_header + segment
D frame = MAC_header + packet
Line B — The Transport layer builds the segment, so it adds the TCP header, not the IP header. It should be segment = TCP_header + data. The IP header is added at the next layer down.
Question 2
A segment = TCP_header + data
B packet = IP_header + segment
C frame = MAC_header + segment
D send(frame)
Line C — Each layer wraps the unit from the layer above. The frame must wrap the packet, so it should be frame = MAC_header + packet. Skipping the packet would lose the IP header.
Question 3
A frame = receive()
B packet = frame.payload
C segment = frame.payload
D data = segment.payload
Line C — The segment is inside the packet, not directly inside the frame. Decapsulation works in reverse order, so it should be segment = packet.payload.
Question 4
A 1 Application: add MAC header
B 2 Transport: add TCP header
C 3 Internet: add IP header
D 4 Link: add header + trailer
Line A — The Application layer is where the data is created, before any headers are added. The MAC header is only added at the Link layer, so line 1 should be 1 Application: create data.
Question 5
A 1 Link: remove header+trailer
B 2 Internet: remove IP header
C 3 Transport: remove TCP header
D 4 Application: add TCP header
Line D — The receiver only removes headers as data moves up the layers. By the Application layer all headers are gone and the data is read, so it should be 4 Application: read the data.

Student with a class code? Join your class →