Back to all articles
OSI ModelEncapsulationNetworking Basics

The OSI Model Explained: A Top-Down Approach

Elena RostovaJuly 2, 2024

When you learn networking, the OSI (Open Systems Interconnection) model is usually taught from the bottom up. You start with physical cables (Layer 1), move to MAC addresses (Layer 2), then IP addresses (Layer 3), and eventually arrive at the application you are actually using (Layer 7).

While that makes sense historically, it's not how users experience the internet. When you click a link in your browser, you aren't thinking about copper wires; you are thinking about the webpage.

So, let's explore the OSI model from a top-down perspective. Let's see what happens to your data as it descends from the app on your screen down into the physical wires.

Layer 7: The Application Layer

This is the only layer you actually interact with. It contains the protocols that power the software you use every day.

When you open Chrome and type `https://example.com`, your browser uses HTTP/HTTPS (Hypertext Transfer Protocol). If you are sending an email, your email client uses SMTP (Simple Mail Transfer Protocol). If you are transferring a file, you might use FTP.

Layer 7's job is to take your human action (like clicking a button) and translate it into a standardized request. In our case, the browser generates an HTTP GET request asking the server for a webpage.

Layer 6: The Presentation Layer

Before the data can go anywhere, it needs to be formatted so the other side can understand it.

If Layer 7 says, "I want to send this picture," Layer 6 is the layer that says, "Okay, I will format this picture as a JPEG." It handles character encoding (like translating text into UTF-8) and, crucially, encryption.

When you use HTTPS, the SSL/TLS encryption happens primarily at this layer (and Layer 5). The Presentation layer takes the raw HTTP request and scrambles it so that no one listening on the wire can read it.

Layer 5: The Session Layer

Now we have encrypted data, but how do we manage the conversation?

The Session layer is responsible for opening, maintaining, and closing the communication channel between your computer and the server. Think of it like a telephone operator. It says, "Okay, I am opening a connection to the server. I will keep this connection alive as long as we are downloading the webpage. If the connection drops, I will try to resume it where we left off."

Layer 4: The Transport Layer

This is where things start getting chopped up.

Your HTTP request (and the resulting webpage) might be too large to send as a single chunk. The Transport layer breaks the data down into smaller pieces called Segments.

It also makes a crucial decision about reliability. Will it use TCP (Transmission Control Protocol), which meticulously numbers every segment and guarantees delivery? Or will it use UDP (User Datagram Protocol), which just blasts the segments out as fast as possible? Since we are loading a webpage, it chooses TCP. It assigns a Source Port (like 54321) and a Destination Port (443 for HTTPS).

Layer 3: The Network Layer

Now we have our segments, but they need to know where to go.

The Network layer takes each segment and wraps it in a new envelope called a Packet. It slaps on two critical pieces of information: your computer's Source IP Address and the server's Destination IP Address.

This layer doesn't care about what the data is; it only cares about the logical routing. It looks at the destination IP and figures out the best path across the vast, global maze of internet routers to get there.

Layer 2: The Data Link Layer

The Network layer knows the final destination, but it doesn't know how to physically get out of your house.

The Data Link layer takes the IP packet and wraps it in yet another envelope called a Frame. It looks at the local network and asks, "Who is the next physical hop?" It stamps the frame with your computer's Source MAC Address and your home router's Destination MAC Address.

While Layer 3 handles end-to-end delivery across the globe, Layer 2 handles hop-to-hop delivery across the immediate physical link.

Layer 1: The Physical Layer

Finally, we hit the bottom. The Frame is ready to go, but it's still just digital 1s and 0s sitting in your computer's memory.

The Physical layer's only job is to convert those 1s and 0s into physical energy. If you are on WiFi, it modulates them into invisible radio waves. If you are plugged into a switch, it converts them into electrical pulses on a copper wire. If you are on a fiber network, it flashes them as pulses of laser light.

These physical signals shoot across the medium, hit your router, and the entire process happens in reverse (decapsulation) as the router figures out where to send it next.

The Magic of Encapsulation

This top-down process—where each layer wraps the data in its own specific envelope of headers before passing it down—is called Encapsulation.

It is the reason the internet scales so beautifully. The browser at Layer 7 doesn't need to know if you are on WiFi or Ethernet. The router at Layer 3 doesn't care if the packet contains a video or an email. Every layer does its one specific job perfectly, oblivious to the rest, allowing you to seamlessly view a webpage from a server ten thousand miles away.