Multiplexing & Demultiplexing: Backbone Transport Services

Demultiplexing Multiplexing

Multiplexing and demultiplexing extend host-to-host delivery services available on the network layer to process-to-process services at the application layer [1]. Multiplexing packages data segments on the sender-side, and demultiplexing unpackages those segments at the receiving-side.

Multiplexing has been around since the advent of telecommunications—think telegrams and telephone switchboards—and is widely used in modern networked communications. This transport layer service varies based on the protocol being used but, ultimately, ensures data packets find their intended destinations.


  • Multiplexing & Demultiplexing help facilitate the conservation of shared network resources
  • Multiplexing/Demultiplexing takes place on the transport layer
  • Multiplexing combines data packets from a sending end system into a single stream to pass to the network layer
  • Demultiplexing ungroups data from a network stream and routes to host:port mappings at a receiving end system
  • TCP & UDP have different types of multiplexing due to protocol differences
  • Multiplexing & Demultiplexing are referred to as “muxing” and “demuxing,” respectively


Conceptually, multiplexing is like tossing all the USPS mail collected from local carriers into a single bin, driving that bin to a sorting center where all the mail gets sent to other local carrier bins, and then having those local carriers deliver the mail to the final recipients.

Note: Multiplexing and demultiplexing services are needed for all networked systems but the discussion herein focuses on their context within Internet Protocol (IP).

Multiplexing (a.k.a. Muxing)

Multiplexing is the encapsulation of multiple data packets by the transport layer into singular segments to pass to the network layer such that host:port addressing can be interpreted on arrival.

multiplexing diagram
Multiplexing takes a parallelized source of information and turns it into a serialized format

Demultiplexing (a.k.a. Demuxing)

Demultiplexing is the decapsulation of network layer segments by the transport layer in a way that uses host:port mappings to direct the individual packets to the corresponding application layer ports.

de multiplexing diagram
Demultiplexing takes a serialized format and distributes it

Transport Layer Support

Multiplexing and Demultiplexing are transport layer services that sit just beneath the application layer. These services are used to group and ungroup application data packets into single packet streams passed to the network layer. Depending on which transport protocols are being used, the multiplexing/demultiplexing processes happen a bit differently.

TCP Multiplexing/Demultiplexing

TCP multiplexing/demultiplexing differs in that all of the following fields are used {source IP, source port, destination IP, destination port}. This need reflects the connection-oriented nature of TCP protocol. All four fields are demultiplexed upon arrival such that reliable data services are supported.

This ensures that data packets from different sources arrive at their destination ports and can be easily identified, ordered, and checked to ensure integrity. This allows two TCP segments arriving at the transport layer, being directed to the same host:port mapping, to be directed to different sockets on the destination end system.

UDP Multiplexing/Demultiplexing

When a UDP socket is created, the transport layer assigns it a socket. In the case of server sockets, server application logic often dictates which port is to be used. In either case, no other local processes should be assigned to these ports.

The transport layer encapsulates the application layer data along with destination IP and destination port information and passes it along to the network layer. Note that no information about the source IP or source port is included. This is because UDP is a connectionless protocol that is inherently unreliable.

One immediate consequence of no source information is that multiple UDP packets originating from different sources—but addressed to the same destination IP and port—will arrive at the same destination socket. Source IP and port information are only accessible at the application layer after the UDP packet has been ingested by the application.


Multiplexing and demultiplexing are powerful means of ensuring shared network resources are not wasted. It’s been around for centuries but still finds relevancy across a wide range of modern networked devices. TCP and UDP multiplexing/demultiplexing happen a little differently, but both still happen on the transport layer and use IP:Port mappings to provide service.


[1] James F. Kurose, Keith W. Ross. Addison-Wesley, Saddle River, New Jersey, 2013. Computer Networking: A top-down approach-sixth edition.

Zαck West
Full-Stack Software Engineer with 10+ years of experience. Expertise in developing distributed systems, implementing object-oriented models with a focus on semantic clarity, driving development with TDD, enhancing interfaces through thoughtful visual design, and developing deep learning agents.