Seven-Segment Decoder from Logic Gates

A seven-segment display shows a digit by lighting some of its seven bars, a to g. A decoder turns a binary number into which bars to light. This one is built from gates alone — no 74LS47 — and shows the digits 0 to 7 from three switches, C, D and E.

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 all eight inputs and read the digit.
  • Ctrl-click (⌘-click on a Mac) a segment line to trace it back to the terms that light it.

Seven-segment decoder truth table

CDEDigit shown
0000
0011
0102
0113
1004
1015
1106
1117

How it works

  • a = D + C′E′ + CE (the top bar: on for 0, 2, 3, 5, 6, 7)

Each of the seven segments is its own function of the three inputs: segment a, for one, is off only for 1 and 4.

Several segments need the same product terms, so each term is built once and shared — which is how a real decoder keeps its gate count down.

A 74LS47 (common-anode) or 74LS48 (common-cathode) does all of this in one chip, for the digits 0–9.

Building it from 74-series chips

74LS04inverters for C′, D′, E′
74LS08the shared product terms
74LS32OR gates, one set per segment
74LS47 / 74LS48or a whole BCD-to-seven-segment decoder

More example circuits

Build your own.

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