What is Encapsulation in Networking?
Encapsulation is the process of adding additional information (headers and sometimes trailers) to data as it passes through the layers of the OSI model for transmission across a network.
Each layer in the OSI model performs specific functions and adds its own protocol information, helping the receiving device understand how to handle the data.
Encapsulation in OSI Model (Layer-wise Breakdown)
| OSI Layer | Data Unit | Encapsulation Details |
|---|---|---|
| 7. Application | Data | User initiates the data transfer (e.g., HTTP request, email content). |
| 6. Presentation | Data | Data is translated, encrypted, or compressed. |
| 5. Session | Data | Session info is added to establish and manage communication between source and destination. |
| 4. Transport | Segment | Port numbers are added. Ensures reliable delivery via TCP or fast delivery via UDP. |
| 3. Network | Packet | IP addresses (source & destination) are added to the segment, forming a packet. |
| 2. Data Link | Frame | MAC addresses are added. A trailer (like Frame Check Sequence) may also be added for error detection. |
| 1. Physical | Bits | The frame is converted to 0s and 1s and transmitted through cables or wireless. |

Step-by-Step Example of Encapsulation
Let’s say a user wants to send a message: "Hello" to another computer via email.
Encapsulation Process:
- Application Layer (Layer 7): Message “Hello” is created.
- Presentation Layer (Layer 6): Message is encoded, possibly encrypted.
- Session Layer (Layer 5): Session is established for sending data.
- Transport Layer (Layer 4): Adds port numbers (e.g., Port 25 for SMTP).
- Network Layer (Layer 3): Adds IP addresses (e.g., 192.168.0.1 to 192.168.0.5).
- Data Link Layer (Layer 2): Adds MAC addresses.
- Physical Layer (Layer 1): Converts data into electrical/optical signals or radio waves.
Final Output: Stream of bits sent across the network.
Decapsulation Process
At the receiving end, the reverse happens:
- Bits → Frame → Packet → Segment → Data
- Each OSI layer strips its corresponding header/trailer.
- Finally, the message “Hello” is delivered to the user.
Why Encapsulation Matters
- Adds information necessary for routing, addressing, and error checking.
- Allows modular communication between systems (each layer focuses only on its own task).
- Enables interoperability between devices from different manufacturers.
- Makes troubleshooting and packet analysis (e.g., using Wireshark) easier.
Tip to Remember the OSI Layers
From Layer 7 to Layer 1:
“All People Seem To Need Data Processing”
From Layer 1 to Layer 7:
“Please Do Not Throw Sausage Pizza Away”
