2-to-4 Decoder

A 2-to-4 decoder takes a two-bit number and lights exactly one of four outputs — the one whose number it is. It is how a computer picks one memory chip, one register or one display out of several.

Try it live

This is the Circuit Simulator itself, running in the page — it is LogicsBench's own example design, read-only. Open it full size, and sign in to make your own copy to change.

  • Count through 00, 01, 10, 11 and watch the lit output step along.
  • Fork it and add a third input to make a 3-to-8 decoder, like the 74LS138.

2-to-4 decoder truth table

ABY0Y1Y2Y3
001000
010100
100010
110001

How it works

  • Y0 = A′B′
  • Y1 = A′B
  • Y2 = AB′
  • Y3 = AB

Each output is one minterm of A and B: an AND of the inputs, each straight or inverted.

Because every minterm has its own output, a decoder and an OR gate can build any function of its inputs — OR together the outputs where the function is 1.

The 74LS139 holds two of these, with active-low outputs (the chosen line goes to 0) and an enable input on each.

Building it from 74-series chips

74LS04two inverters make A′ and B′
74LS08four AND gates, one per output
74LS139or two whole decoders in one chip, active-low

More example circuits

Build your own.

The Circuit Simulator is free, in your browser — start from a blank page or from this example.