Each layer in the layered architecture provides service to the layers which are directly above and below it. The outgoing information will travel down through the layers to the lowest layer. While moving down on the source machine, it acquires all the control information which is required to reach the destination machine. The control information is in the form of headers and footers which surrounds the data received from the layer above. This process of adding headers and footers to the data is called as data encapsulation. The headers and footers contain control information in the individual fields. it is used to make message packet reach the destination. The headers and footers form the envelope which carries the message to the desired destination.
The figure shows the example of five layer stack for data encapsulation. The fifth layer of sending machine wants to send a message M to the fifth layer of destination machine. The message M is produced by layer 5 of machine 1 and given to layer 4 for transmission. Layer 4 adds header H4 in front of the message and pass it to layer 3. Layer 3 breaks up the incoming message into small units as M1 and M2 and pass these packets to layer 2. Layer 2 adds the header as well as footer to each packet obtained from layer 3 and pass it to layer 1 for physical transmission.