Data encapsulation

The term encapsulation describes a process of putting headers (and sometimes trailers) around some data. Each layer adds its own header (Data Link protocols also add a trailer) to  the data supplied by the higher layer. This process can be explained with the five-layer TCP/IP model (the Link layer of the TCP/IP model is sometimes divided into two  layers, Data Link and Physical, hence the five-layer TCP/IP model), with each step corresponding to the role of each layer.

Consider the following example. Let’s say that you are browsing a web site. The web server on which the website is hosted will create and encapsulate the application data with the Application layer headers. For example, the HTTP OK message will be stored in the header, followed by the requested content of the web page.

The encapsulated data will then be  forwarded to the next layer, the Transport layer. The Transport layer will add its own header around the encapsulated data. In the case of the TCP protocol, this can be something like the source and destination ports or the sequence number.

The data will then be forwarded to the next layer – the Network layer. The Network layer will  store the source and destination IP addresses in its header and forward the data to the Data Link layer. The Data Link layer is the only layer that uses both the header and trailer.

The data is then sent through a  physical network link.

Here is a graphical representation of these five steps:

encapsulation process


Each data packet (header + encapsulated data) defined by a particular layer has a specific name:

  • Frame – encapsulated data defined by the Network Access layer. A frame can have both header and trailer.
  • Packet – encapsulated data defined by the Network layer. A header contains the source and destination IP addresses.
  • Segment – encapsulated data defined by the Transport layer. Information such as the source and destination ports or sequence and acknowledgment numbers are included in the header.


The term decapsulation describes a process of removing headers and trailers as data passes from a lower to the upper layer. This process transpires on a computer that is receiving data.
Geek University 2021