The OSI model splits networking into seven stacked layers, from the application at the top down to the physical wire at the bottom. The whole point is *separation of concerns*: each layer has one job and talks only to the layer directly above and below it — so a web browser never has to know whether it's running over fibre or Wi-Fi.
The seven layers, top to bottom
17 · Application — the protocols apps speak: HTTP, DNS, SMTP. This is the data you actually care about.
26 · Presentation — formatting, translation, encryption, compression: how the data is represented (e.g. TLS, character encoding).
35 · Session — opening, managing, and closing a conversation between two endpoints.
44 · Transport — end-to-end delivery, split into segments, addressed by ports. TCP adds reliability; UDP doesn't.
53 · Network — logical addressing (IP) and routing a packet across many networks. Routers live here.
62 · Data Link — node-to-node delivery on one physical link, using MAC addresses and framing. Switches live here.
71 · Physical — raw bits as electrical, optical, or radio signals on the medium.
A mnemonic that sticks
Top to bottom: All People Seem To Need Data Processing — Application, Presentation, Session, Transport, Network, Data Link, Physical.
Encapsulation: nested envelopes
Sending data walks *down* the stack. At each layer a header of control information is wrapped around whatever came from above — this is encapsulation. Receiving walks *up* the stack and strips those headers back off in reverse order (decapsulation). Crucially, each layer's header is read only by its counterpart on the other machine: the receiver's Network layer reads the sender's Network header, and so on.
The data chunk has a different name at each layer — its PDU (protocol data unit): it's Data up at Application through Session, a Segment at Transport, a Packet at Network, a Frame at Data Link, and finally raw Bits at Physical.
OSI is a teaching map; TCP/IP is what runs
The real internet runs on the simpler 4-layer TCP/IP model: Application, Transport, Internet, and Link. Its layers map onto groups of OSI layers — TCP/IP's single Application layer covers OSI layers 5–7, and its Link layer covers OSI layers 1–2.
OperationTimeSpace
OSI · Data, Segment, Packet, Frame, Bits7 layersApp → Physical
TCP/IP · what the internet actually uses4 layersApp, Transport, Internet, Link
Check yourself
On the receiving machine, which layer reads a given header?