Line codes for digital transmissions

I recently wrote a short wiki article about line codes for digital transmissions. I wrote it to gain a bonus for the exam in “Communication Networks 1”, but I think it might be interesting for you, too.

Coding Techniques

If two stations want to transfer data over a physical medium, they need to transform the logical data stream into some physical form (and vice versa) in order to be transmitted. Although there also exist means to transmit analog data like simple amplitude or frequency modulation (AM, FM), I will concentrate on techniques for transmitting digital data using a medium which offers multiple (two or more) voltage levels.

Design goals

A designer of such an encoding scheme works towards different – sometimes contradictory – objectives:

  • Simplicity: The implementation of the scheme should be simple, cost efficient and little error-prone.
  • Efficiency: The available bandwidth should be used as efficient as possible.
  • Robustness: If an error occurrs, it should be detected and maybe even corrected.
  • Synchronisation: The sender and receiver need to have a common clock in order to know where symbols begin and end. This could be achieved either by a seperately transmitted clocking signal or by special encodings.

To look at bandwidth efficiency, it is useful to compare the bit and symbol rates. Bits are the logical units to be transferred while symbols are the physical signals which are transmitted over the medium. The symbol rate is measured in baud (symbols per second). It can differ from the bitrate as we will see.

Non-return-to-zero (NRZ)

"11001010" transmitted using NRZ

NRZ uses two voltage levels. These are directly mapped to the logical bits.


  • High efficiency: NRZ can transmit one bit per symbol
  • Simplicity: The implementation is straightforward.


  • There is no redundant data so errors cannot be detected.
  • If a series of ones or zeroes is transmitted, the peers may get out of sync because there are no transitions between different levels. This could be circumvented by bit stuffing.

Return-to-zero (RZ)

In RZ, bits are encoded as in NRZ with the exception that when a one is transmitted, the signal returns to zero level in the middle of the bit.

"11001010" transmitted using RZ

This solves only a part of the clocking issues of NRZ. If a series of zeroes is transmitted, the problem persists. Also, the bandwidth efficiency is decreased: RZ needs two symbols (1: 10, 0: 00) to transmit one bit. There is, however, an improvement concerning robustness. If two “high” symbols are received in a row, this can be detected as an error.

Manchester encoding

"11001010" transmitted using Manchester encoding

Manchester encoding offers syncronisation by ensuring that for every transmitted bit there is at least one transition. A logical one is encoded by 10 while a logical zero is encoded by 01 (may be inverted for some applications, for example Ethernet).

This still has the disadvantage of needing two symbols for transmitting one bit, but it dismisses the user of the channel from caring about synchronisation.

Differential Manchester encoding

Differential Manchester encoding is a slightly more complex variation of plain Manchester encoding. Instead of directly encoding zeroes and ones by fixed pairs of symbols, a one is encoded by changing between 01 and 10 while for a zero the last symbol pair gets repeated.

"11001010" transmitted using differential Manchester encoding

This encoding has some advantages over plain Manchester encoding in terms of robustness. For example, it is less vulnerable to noise and it even works if the polarity of the signal is inverted. On the other hand the implementation is more complex.

8b/10b encoding

This code encodes 8 bits of data in only 10 symbols while maintaining the synchronisation property at the same time.

To encode a byte of data, it is split into two tuples of 5 and 3 bits. These are independently replaced by 6 respectively 4 bits, taken from a lookup table. This table is built to guarantee that no more than 5 bits of the same value appear in the encoded data. The concrete tables can be looked up in the original paper, listed at the bottom of this page.

"11001010" transmitted using 8b/10b encoding

8b/10b encoding is complex to implement because of the lookup tables, but it is also highly bandwidth efficient and is therefore used in many high perfomance data links like PCI Express, FireWire, Gigabit Ethernet or DVI.


There are plenty of encodings not discussed in this article. Some of them are just variations of the above coding techniques (alternate mark inversion (AMI) for example), some others use multiple voltage levels or introduce completely new ideas.

To compare different line codes to each other, I recommend playing with the “Line codec analyzer” by Grega PreΕ‘eren (see section below).


Leave a Reply

Your email address will not be published. Required fields are marked *