This article needs additional citations for verification. (March 2009) (Learn how and when to remove this template message)
In telecommunication, 4B5B is a form of data communications line code. 4B5B maps groups of 4 bits of data onto groups of 5 bits for transmission. These 5 bit words are pre-determined in a dictionary and they are chosen to ensure that there will be sufficient transitions in the line state to produce a self-clocking signal. A collateral effect of the code is that 25% more bits are needed to send the same information.
Depending on the standard or specification of interest, there may be several 5-bit output codes left unused. The presence of any of the unused codes in the data stream can be used as an indication that there is a fault somewhere in the link. Therefore, the unused codes can be used to detect errors in the data stream.
4B5B was popularized by fiber distributed data interface (FDDI) in the mid-1980s, and was later adopted by Fast Ethernet standard defined by IEEE 802.3u in 1995 and AES10-2003 Multichannel Audio Digital Interface (MADI).
The name 4B5B is generally taken to mean the FDDI version. Other 4-to-5-bit codes have been used for magnetic recording and are known as group coded recording (GCR), but those are (0,2) run-length limited codes, with at most two consecutive zeros. 4B5B allows up to three consecutive zeros (a (0,3) RLL code), providing a greater variety of control codes.
The 4B5B encoding is also used for USB Power Delivery communication on CC pin, over BMC protocol.
4B5B codes are designed to produce at least two transitions per 5 bits of output code regardless of input data. When NRZI-encoded, the transitions provide necessary clock transitions for the receiver. For example, a run of 4 bits such as 00002 contains no transitions and that causes clocking problems for the receiver. 4B5B solves this problem by assigning the 4-bit block a 5-bit code, in this case 111102.
The following codes are sometimes referred to as command characters.
|Control character||5b symbols||Purpose|
|JK||11000 10001||Sync, Start delimiter|
|I||11111||100BASE-X idle marker|
|TT||01101 01101||FDDI end delimiter|
|TS||01101 11001||Not used|
|TR||01101 00111||100BASE-X end delimiter|
|SR||11001 00111||Not used|
|SS||11001 11001||Not used|
|H||00100||100BASE-X transmit error|
(HDLC = High-Level Data Link Control)