LogicGates.org Open the simulatorSimulator

3-to-8 decoder

A 3-to-8 decoder is a combinational circuit that takes a three-bit binary number and raises exactly one of its eight outputs, the one whose index matches the input.

Turns a 3-bit number into one hot line out of eight.

Circuit diagram

Toggle the inputs and follow the signals: green wires are high, red are low. The highlighted row of the truth table below is the one you have set.

y0 1 y1 0 y2 0 y3 0 y4 0 y5 0 y6 0 y7 0

Truth table

ABC y0y1y2y3y4y5y6y7
000 10000000
001 01000000
010 00100000
011 00010000
100 00001000
101 00000100
110 00000010
111 00000001

Boolean expressions

y0
¬a ∧ ¬b ∧ ¬c high for 000
y1
¬a ∧ ¬b ∧ c high for 001
y2
¬a ∧ b ∧ ¬c high for 010
y3
¬a ∧ b ∧ c high for 011
y4
a ∧ ¬b ∧ ¬c high for 100
y5
a ∧ ¬b ∧ c high for 101
y6
a ∧ b ∧ ¬c high for 110
y7
a ∧ b ∧ c high for 111

How it works

The same idea as the 2-to-4 decoder with one more input bit: each output is a single three-input AND of the inputs in the right polarity, so the eight outputs are the eight minterms of A, B and C. Three inverters and eight AND gates make the whole circuit, and this is the size that turns up most often as a real part, the 74138, which adds enable inputs so that two of them can be wired into a 4-to-16.

Where it is used

  • Selecting one of eight registers, memory chips or peripherals from three address bits.
  • Generating all the minterms of three variables at once, so any three-input function is an OR of some outputs.
  • Converting a three bit state number into one hot signals for a state machine.

Build it

Three NOTs and eight ANDs with three inputs each; the simulator lets an AND take three inputs directly. Wire the inputs to three toggles and watch one output at a time light as you count.

Open the simulator

Or draw it from the expressions above with the circuit diagram generator, in either symbol standard, and export it as SVG, PNG, Verilog or VHDL.

Reference card

The diagram above as an image, black on white, for notes or a slide.

3-to-8 decoder logic circuit diagram with inputs a = A, b = B, c = C: y0 from ¬a ∧ ¬b ∧ ¬c, y1 from ¬a ∧ ¬b ∧ c, y2 from ¬a ∧ b ∧ ¬c, y3 from ¬a ∧ b ∧ c, y4 from a ∧ ¬b ∧ ¬c, y5 from a ∧ ¬b ∧ c, y6 from a ∧ b ∧ ¬c, y7 from a ∧ b ∧ c Click to download: 3-to-8 decoder circuit diagram

Questions about the 3-to-8 decoder

How does a 3-to-8 decoder work?

Each output is an AND gate that is only satisfied by one input pattern. Y5, for instance, is A ∧ ¬B ∧ C, which is 1 only for 101. Three inverters supply the complemented inputs, so the whole circuit is three NOT gates and eight three-input AND gates, and exactly one output is high at any time.

How do you make a 4-to-16 decoder from 3-to-8 decoders?

Use two of them and the fourth, most significant, input bit as an enable: when it is 1 it enables the upper decoder, for outputs 8 to 15, and inverted it enables the lower one. Real 3-to-8 parts such as the 74138 have an active-high enable and two active-low ones, so with them no inverter is needed, and the same trick stacks any number of stages.

What is the difference between a decoder and a demultiplexer?

A demultiplexer is a decoder with a data input ANDed into every output, so the selected line carries the data rather than a constant 1. A decoder with an enable input is already a demultiplexer if you feed the data into the enable, which is why parts like the 74138 are sold under both names.

The other circuits