All subjects · Computer Science · WCP03 Advanced Principles of Computer Science

The OSI reference model, encapsulation and decapsulation

Edexcel IAL Computer Science · WCP03 Advanced Principles of Computer Science

Networks are built in layers so that each layer can be designed and changed independently. The OSI model has seven layers and gives everyone a common language for describing what happens to data on its journey.

Practise this in the app: instant marking and a fix for every mistake. Free, no email needed to start.

Practise this lesson

The seven layers

From the top (closest to the user) down:

No.LayerJobData unit / examples
7ApplicationNetwork services for applicationsHTTP, SMTP, DNS
6PresentationData format, character encoding, compression, encryptionTLS encryption, JPEG
5SessionOpens, manages and closes sessions (dialogues) between applicationsSession checkpoints
4TransportEnd-to-end delivery; splits data into segments; ports; error recovery and flow controlSegments; TCP, UDP
3NetworkLogical addressing and routing between networksPackets; IP, routers
2Data linkNode-to-node delivery on one link; MAC addresses; error detectionFrames; Ethernet, Wi-Fi, switches
1PhysicalTransmits raw bits as signalsBits; cables, radio, hubs

Memory aid (top down): All People Seem To Need Data Processing

Why layers?

Encapsulation and decapsulation

Encapsulation happens on the sending device as data moves down the layers: each layer adds its own header (and the data link layer also adds a trailer, often a checksum) around the data it receives from above.

Decapsulation happens on the receiving device as data moves up: each layer reads and removes its own header and passes the rest up.

In a diagram, the transport layer wraps the data into a segment; the network layer wraps the segment into a packet; the data link layer wraps the packet into a frame; the physical layer sends the frame as bits.

Worked example

A web page is sent from a server to your browser. Describe what happens at layers 4, 3 and 2 on the server.

  1. Layer 4 (transport): the data is split into segments, each with a header holding the source and destination port numbers and a sequence number.
  2. Layer 3 (network): each segment gets an IP header with source and destination IP addresses, making a packet.
  3. Layer 2 (data link): each packet gets a header with MAC addresses and a trailer for error checking, making a frame.

Answer: Segments, then packets, then frames: one header added per layer.

Key idea: OSI, top down: application, presentation, session, transport, network, data link, physical. Sending: encapsulate (add headers going down). Receiving: decapsulate (remove headers going up).

Check yourself

  1. How many layers does the OSI model have?
    Show answer

    7. Seven layers, from physical (1) to application (7).

  2. Which OSI layer is responsible for routing packets between networks using IP addresses?
    • Data link layer
    • Transport layer
    • Session layer
    • Network layer
    Show answer

    Network layer. Layer 3 handles logical addressing and routing.

  3. Which OSI layer deals with data format, encryption and compression?
    • Physical layer
    • Presentation layer
    • Network layer
    • Data link layer
    Show answer

    Presentation layer. Layer 6 presents data in a form both ends understand.

  4. At which layer are MAC addresses used to deliver frames on a local link?
    • Application layer
    • Transport layer
    • Data link layer
    • Presentation layer
    Show answer

    Data link layer. Layer 2 uses MAC addresses and frames.

  5. What is encapsulation?
    • Each layer adds its own header to the data as it passes down the stack on the sending device
    • Each layer removes its header on the receiving device
    • Encrypting data with a public key
    • Splitting a network into subnets
    Show answer

    Each layer adds its own header to the data as it passes down the stack on the sending device. Going down: wrap; going up: unwrap (decapsulation).

  6. On the receiving device, in which direction does data travel through the layers during decapsulation?
    • Down, from the application layer to the physical layer
    • Sideways, between peer devices only
    • Up, from the physical layer to the application layer
    • It skips straight to the application layer
    Show answer

    Up, from the physical layer to the application layer. Each layer removes its header and passes the rest upward.

  7. Which is a benefit of a layered model?
    • One layer's protocol can be replaced without changing the other layers
    • Data no longer needs addressing
    • Every layer must be written by the same company
    • It removes the need for error checking
    Show answer

    One layer's protocol can be replaced without changing the other layers. Layers are independent behind fixed interfaces.

Practise with instant feedback

Sources

Last updated 8 November 2026. Spotted a mistake? Tell us.