Oh My Algorithm
Concept Guide7 Layers · Encapsulation

OSI Model

The OSI 7-layer model standardizes network communication into seven layers: application, presentation, session, transport, network, data link, and physical. Each layer has an independent role, and data moves up and down the layers through encapsulation and decapsulation, attaching and removing headers.

01OSI Model

The OSI 7-layer model. The sender goes top (application) to bottom (physical), each layer wrapping the data in a header (encapsulation).

Layer 7 Application · the user creates the data to send (e.g. the HTTP request "Hello!").

Layer 6 Presentation · compress, encrypt, and encode the plaintext into a common format. The payload becomes ciphertext.

Layer 5 Session · open and manage the connection (session) between the two hosts.

Layer 4 Transport · wrap the data in a TCP header (ports, sequence numbers) to form a Segment.

Layer 3 Network · wrap it once more in an IP header (source and destination addresses) to form a Packet.

Layer 2 Data Link · wrap it in a frame header (FH) and trailer (FT, error detection) to form a Frame.

Layer 1 Physical · convert the frame into 0s and 1s as electrical or optical signals and send it over the cable.

Arrival at the receiving host · now go in reverse, bottom (physical) to top (application), stripping headers (decapsulation).

Layer 2 Data Link · remove the frame header and trailer and check for errors.

Layer 3 Network · strip the IP header and confirm this host is the destination.

Layer 4 Transport · strip the TCP header and reorder the segments. The payload is still ciphertext.

Layers 5–7 · through the session, the presentation layer decrypts and decompresses, restoring the payload to the original plaintext ("Hello!").

Delivery complete · each layer shares the work by adding and removing headers, so changing one layer barely affects the rest.

Sending host↓ Encapsulation (add headers)
📦📦📦
🌐7Application
🔐6Presentation
🤝5Session
📦4Transport
🧭3Network
🔗2Data Link
📡1Physical
Data
Hello!
1 / 14

02 Understand It Simply

For Everyone
🔑How It Works

Data descends the layers, each wrapping it in its own header, and the receiver strips them in the same order. A layer reads only its own header and knows nothing of the layers below.

💡In Plain Words

A standard model that divides network communication into seven layers.

The sender goes top (application) to bottom (physical), adding each layer's header (encapsulation); the receiver strips them in reverse on the way up.

Because each layer is independent, changing one barely affects the rest.

📍Where It's Used
  • Understanding network structure
  • distinguishing protocol layers
  • diagnosing which layer a fault belongs to

03 Frequently Asked Questions

FAQ
What is OSI Model?+

The OSI 7-layer model standardizes network communication into seven layers: application, presentation, session, transport, network, data link, and physical. Each layer has an independent role, and data moves up and down the layers through encapsulation and decapsulation, attaching and removing headers.

Where is OSI Model used?+

Understanding network structure, distinguishing protocol layers, diagnosing which layer a fault belongs to.

What's a simple analogy for OSI Model?+

Data descends the layers, each wrapping it in its own header, and the receiver strips them in the same order. A layer reads only its own header and knows nothing of the layers below.