Difference Between Encapsulation and Decapsulation

May 2022 · 6 minute read

Key Difference – Encapsulation vs Decapsulation
 

Data is important for every organization. Therefore, it is necessary to send the data to another location easily with a minimum amount of time. The data can be sent to the destination using the network. A network is a collection of interconnected devices such as computers, printers for sharing resources. When there is a large number of hosts, the network becomes complex, connecting different computers increases the incompatibility. Therefore, open standard network models were improved. Two common network models are International Organization for Standardization (OSI) and  Transmission Control Protocol / Internet Protocol (TCP/IP). TCP/IP is the new network model that is a replacement for OSI model. These models contain layers. Data goes through the layers of data communication. Encapsulation and Decapsulation are two terms related to passing data through each layer. The key difference between encapsulation and decapsulation is that, in encapsulation, the data moves from upper layer to the lower layer, and  each layer includes a bundle of information known as a header along with the actual data while, in decapsulation, the data moves from the lower layer to the upper layers, and each layer unpacks the corresponding headers to obtain the actual data.

CONTENTS

1. Overview and Key Difference
2. What is Encapsulation
3. What is Decapsulation
4. Similarities Between Encapsulation and Decapsulation
5. Side by Side Comparison – Encapsulation vs Decapsulation in Tabular Form
6. Summary

What is Encapsulation?

Network models are used to standardize network communication. When sending data from one location to the other, the data goes through a number of layers. The TCP/IP model has four layers. They are application layer, transport layer, internet layer and network access layer. Each layer performs a specific role in the TCP/IP model. The application layer has all the end user services such email facilities, web browsing etc. The transport layer manages the host to host communication. In network layer, the data is known as packets. It provides source and destination IP addresses that helps to identify the location in the network. Each device in the network has an IP address. In network access layer, the packet is called  a frame. In this layer, the packet came from the internet layer is given the source and destination MAC addresses. MAC address is the physical address. Finally, the frame is sent out of the network.

Assume sending an email. The email is created in the application layer. The email should pass the layers transport layer, internet layer and network access layer in order, using different protocols and out of a computer using wireless or wired network interface. Then the email travels through the network and comes to the destination. Then, the email goes from network access layer, internet layer and transport layer and to the application layer in order.

Difference Between Encapsulation and Decapsulation

Figure 01: TCP/IP model

Encapsulation is the process of adding information to the application layer data as it is sent through each model layer. Each time the data passes a layer, a new Protocol Data Unit (PDU)  is created. The data sent from the application layer has added a header with information on TCP/UDP in the transport layer. Now the data is known as a segment. When that segment reaches the internet layer, the segment is added a header with IP addresses. Now it is called a packet. When the packet reaches the network access layer, a header with MAC addresses is added. Now it is known as a frame. Likewise, in each layer, a corresponding Protocol Data Unit (PDU) is created. Adding this information in each layer is known as Encapsulation. When the encapsulation process is completed, the frame is sent to the network.

What is Decapsulation?

As explained in the encapsulation process, the frame goes out of the host computer to the network. Then it reaches the destination host. In the destination host, the frame is decapsulated in the reverse order till the application layer. The frame which reaches the network access layer contains the data, TCP/UDP header, header with IP addresses and header with MAC addresses.

When it is sent to the network layer, it is a packet and has data, TCP/UDP header and header with IP address. Then the packet reaches the transport layer. Now it is segmented and contains data and TCP/UDP  header. Finally, the segment reaches the application layer. In the application layer, the host can see the data sent from the source computer. This process is known as Decapsulation.

What is the Similarity Between Encapsulation and Decapsulation?

What is the Difference Between Encapsulation and Decapsulation?

Encapsulation vs Decapsulation

When the data is moving from upper layer to the lower layer according to a network model, each layer includes a bundle of information called a header along with the actual data. This packing of data in each layer is known as the encapsulation.When the data is moving from the lower layer to the upper layers according to the network model, each layer unpacks the corresponding headers and uses that information to obtain the actual data. This unpacking of data in each layer is known as the decapsulation.
 Occurrence
Encapsulation occurs in the source computer.Decapsulation occurs in the destination computer.

Summary – Encapsulation vs Decapsulation 

A network is a connection with a large number of devices. These devices are different from one to another. That can create compatibility issues. To avoid that, all devices in the network use the standard network model for data communication. One major network model is TCP/IP model. These models consist of a number of layers. The data which should be transmitted to a new location should go through each layer. When reaching each layer, the information is added to the data. It is called encapsulation. When the data reaches the destination, in each layer the added information is unpacked. That process is known as decapsulation. The difference between encapsulation and decapsulation is that, in encapsulation, the data is moving from upper layer to the lower layer, and  each layer includes a bundle of information called a header along with the actual data while in decapsulation, the data is moving from the lower layer to the upper layers, and each layer unpacks the corresponding headers to obtain the actual data.

Download the PDF of Encapsulation vs Decapsulation

You can download the PDF version of this article and use it for offline purposes as per citation note. Please download the PDF version here: Difference Between Encapsulation and Decapsulation

Reference:

1. TCP/IP Data Encapsulation and Decapsulation. Available here 

Image Courtesy:

1.’UDP encapsulation’By Cburnett, (CC BY-SA 3.0) via Commons Wikimedia  

ncG1vNJzZmivp6x7pbXFn5yrnZ6YsqOx07CcnqZemLyue8OinZ%2Bdopq7pLGMm5ytr5Wau26xzZyYqauloa61tc6nZJqmlGLDtHnDnpqaqKOquaLAyKilaA%3D%3D