1. Home
  2. Computer Networks
  3. OSI & TCP/IP Layers

OSI & TCP/IP Layers

Follow one web request down the 7 layers of the sender, across the wire, and up the receiver — watching each layer add and remove its header in 3D.

Interactive 3DBeginner12 min readCNUpdated

Drag to rotate · Right-drag to pan · Click, then scroll to zoom · Space play · Left arrowRight arrow step

What's happening

Networking is split into layers, each with one job. Press Send a message to follow a web request down the sender’s stack, across the wire, and up the receiver’s stack.

Pseudocode

  1. sender: data goes DOWN the layers — each adds its header (encapsulation)
  2. the bits travel over the wire / radio
  3. receiver: data goes UP — each layer removes its header (decapsulation)
Read this model as text · 18 steps

One run of the model above, written out step by step. Useful with a screen reader, on a slow connection, or for quick revision. The values may differ from the run on your screen.

  1. Networking is split into layers, each with one job. Press Send a message to follow a web request down the sender’s stack, across the wire, and up the receiver’s stack.
  2. Sender — 7 Application: The app (your browser) creates the message: GET /index.html (HTTP).
  3. Sender — 6 Presentation: Translates and protects the data: character encoding, compression and encryption (TLS).
  4. Sender — 5 Session: Opens, manages and closes the conversation (session) between the two programs.
  5. Sender — 4 Transport: Adds a TCP header: port numbers (which app), sequence numbers and checksums for reliable delivery. The unit is now a segment.
  6. Sender — 3 Network: Adds an IP header with source and destination IP addresses so routers can forward it across networks. Now it is a packet.
  7. Sender — 2 Data Link: Adds a MAC header (hardware addresses of the next hop) and a trailer with an error check (FCS). Now it is a frame.
  8. Sender — 1 Physical: Turns the frame into bits — electrical signals, light pulses or radio waves.
  9. The bits leave the network card as signals…
  10. …travel across cables, Wi-Fi and routers (each router only looks up to layer 3)…
  11. Receiver — 1 Physical: turns the signals back into bits.
  12. Receiver — 2 Data Link: reads and removes the MAC header, then passes the rest up.
  13. Receiver — 3 Network: reads and removes the IP header, then passes the rest up.
  14. Receiver — 4 Transport: reads and removes the TCP header, then passes the rest up.
  15. Receiver — 5 Session: matches the data to the right open session (conversation).
  16. Receiver — 6 Presentation: decrypts and decodes the data.
  17. Receiver — 7 Application: hands the data to the right program.
  18. The web server receives exactly the message the browser sent. Each layer talked only to the layer directly above and below it — that is the power of layering.

Try this in the 3D model

  • Press Send a message and watch the packet grow on the way down. In what order do the headers appear?
  • Pause at the Network layer and read the IP header. Which addresses does it carry?
  • Switch to TCP/IP (4 layers) and compare the slab heights with the OSI model.

Why layers?

Sending a web page across the world involves apps, encryption, reliable delivery, addressing, routing, Wi-Fi radio and fibre optics. Instead of one giant program doing everything, networking is split into layers. Each layer:

  • does one job,
  • uses the services of the layer below, and
  • offers services to the layer above.

You can replace one layer (e.g. Wi-Fi instead of Ethernet) without touching the others.

The OSI model (7 layers)

Remember top-down with “All People Seem To Need Data Processing”:

# Layer Job Examples Data unit
7 Application Network services for apps HTTP, DNS, SMTP, FTP Data
6 Presentation Format, encode, encrypt, compress TLS, JPEG, UTF-8 Data
5 Session Open, manage, close sessions RPC, sockets Data
4 Transport End-to-end delivery, ports, reliability TCP, UDP Segment
3 Network Logical addressing and routing IP, ICMP Packet
2 Data Link Delivery on one link, MAC addresses, error detection Ethernet, Wi-Fi Frame
1 Physical Bits as signals Cables, radio, fibre Bits

Encapsulation and decapsulation

On the sender, data travels down the stack. Each layer adds its own header (and the data link layer also adds a trailer):

[ data ]                                             Application
[ TCP | data ]                                       Transport  → segment
[ IP | TCP | data ]                                  Network    → packet
[ MAC | IP | TCP | data | FCS ]                      Data Link  → frame
0101101001110…                                       Physical   → bits

On the receiver, the data travels up and each layer reads and removes the header added by its peer layer. That’s exactly the animation in the 3D model.

Each layer “talks” only to the same layer on the other machine (via headers), even though physically everything passes through the layers below.

The TCP/IP model (4 layers)

The internet actually uses the simpler TCP/IP model:

TCP/IP layer OSI layers Protocols
Application 7, 6, 5 HTTP, DNS, SMTP, TLS
Transport 4 TCP, UDP
Internet 3 IP, ICMP
Network Access (Link) 2, 1 Ethernet, Wi-Fi

OSI is the reference model used for teaching and troubleshooting (“is it a layer 2 or layer 3 problem?”); TCP/IP is the implementation.

Devices and layers

Device Layer Looks at
Hub, repeater 1 Just signals
Switch 2 MAC addresses
Router 3 IP addresses
Firewall / load balancer 3–7 IPs, ports, sometimes content

What happens when you open a website?

  1. DNS (application) turns example.com into an IP address.
  2. TCP opens a connection with a 3-way handshake.
  3. TLS encrypts the conversation.
  4. The browser sends an HTTP request; it is encapsulated down the layers and sent.
  5. Routers forward the packets hop by hop using routing algorithms.
  6. The server decapsulates the request, sends back the page, and the process repeats in reverse.

Common mistakes

  • Mixing up the order of layers — use the mnemonic.
  • Saying switches route packets — they forward frames within one network; routers move packets between networks.
  • Thinking TCP and IP are the same layer: TCP is transport (4), IP is network (3).

Complexity at a glance

Case / operationTimeWhy
OSI layers7Reference model for teaching and troubleshooting.
TCP/IP layers4The model the internet actually uses.

Quick check

Test yourself — pick an answer to see if you got it.

1. Which layer adds the source and destination IP addresses?

2. What is the PDU (data unit) called at the Transport layer?

3. Encapsulation means…

4. Which device works mainly at the Network layer?

Saved in this browser.
Spotted a mistake or a bug in the 3D model?

Report a mistake

in OSI & TCP/IP Layers. Thank you — every report makes the lesson better for the next reader.

We'll also include a link to the step of the 3D model you're on and your browser type, so we can reproduce it.