Encapsulation is the process of transferring data from the top level of applications down (along the protocol stack) to the physical layer in order to be transmitted over the network physical medium (twisted pair, optical fiber, Wi-Fi, etc.). Moreover, at each level, various protocols add their information to the transmitted data.
Let me remind you that the OSI network model consists of 7 levels (application level, presentation level, session, transport, network, channel and physical). All network devices operate according to the OSI model, only some use all 7 levels, while others use less. This allows you to process incoming data several times faster.
For example, your computer uses all 7 levels, the router uses 3 lower levels, the switch uses only 2 lower levels.
This data is omitted from the application layer to the data presentation layer.
At this level, your computer converts the string of the entered text (address) into a format convenient for transferring further to the lower level.
The transport layer receives data and determines that they should be transmitted further using the TCP protocol. Before transmission, the transport layer breaks the data into pieces of data and adds a header to each piece, which contains information about the logical ports of computers (from which data was sent (for example 1223) and for which it is intended (in this case 80)). At the transport level, these pieces of data with a heading are called segments. Segments are transmitted further down to the network layer.
At the channel level, packets are divided into even smaller pieces of data, and in addition to the header that is added again, only at the channel level, a trailer is added. At this level, the headers contain the physical addresses of the devices – the transmitter and for whom they are intended, and the trailer contains the calculated checksum, a certain code (information) that is used to determine the integrity of the data.
Physical device addresses are MAC addresses.
These very small pieces of data are called frames or frames (the same thing). Further frames are transferred to the physical layer.