Skip to content

BCD to seven-segment decoder: truth table and Karnaugh maps for segments a to g

A BCD to seven-segment decoder turns a 4-bit decimal digit, 0000 to 1001, into the seven signals a to g that light a display's segments. Each segment is a Boolean function of the four bits, and codes 1010 to 1111 never occur, so they are don't-cares.

This guide labels the segments, explains common anode and common cathode displays, gives the full truth table, derives all seven segment expressions with Karnaugh maps that use the don't-cares, and shows how drawing 6, 7 and 9 with or without their tails changes the logic. Every expression is checked by the Tangibool engine against the truth table on all ten digits.

The seven-segment display

A seven-segment display draws each digit with seven bars, named a to g:

SegmentPosition
atop
btop right
cbottom right
dbottom
ebottom left
ftop left
gmiddle

Many displays add an eighth segment, dp, for the decimal point, which the decoder does not drive.

Each segment is a light-emitting diode, and the diodes share one connection:

  • Common cathode. All the cathodes are joined to ground, and a segment lights when its own pin is driven high, to 1. The decoder's outputs are active-high, and the expressions below drive them directly.
  • Common anode. All the anodes are joined to the supply, and a segment lights when its pin is pulled low, to 0. The decoder's outputs are active-low: each one is the complement of the expression below.

Either way, each segment needs a current-limiting resistor, and a display bought for one kind will not work with a decoder made for the other without inverting every output.

The BCD input

Binary-coded decimal (BCD) writes one decimal digit in four bits with the weights 8, 4, 2 and 1. This guide names the bits D (8), C (4), B (2) and A (1), as the classic decoder chips and the segment a worked example do, so the digit 6 is D C B A = 0110.

Four bits can hold 16 codes, but only 0 to 9 are digits. The codes 10 to 15 (1010 to 1111) never occur in BCD, which gives the designer freedom: on those rows a segment may be on or off, whichever makes its expression simpler. Such rows are don't-cares, marked X. The valid codes are exactly those where not (D and (C or B)): a digit of 8 or 9 has C = 0 and B = 0. The equivalence checker confirms that this condition picks out the minterms 0 to 9. The worked example of BCD greater than five uses the same condition.

The truth table

1 means the segment is lit. The digits 6 and 9 are drawn with tails (segment a on for 6, segment d on for 9), and 7 without one:

DigitD C B Aabcdefg
00 0 0 01111110
10 0 0 10110000
20 0 1 01101101
30 0 1 11111001
40 1 0 00110011
50 1 0 11011011
60 1 1 01011111
70 1 1 11110000
81 0 0 01111111
91 0 0 11111011
10 to 151 0 1 0 to 1 1 1 1XXXXXXX

As minterm lists, one per segment: a = Σm(0, 2, 3, 5, 6, 7, 8, 9), b = Σm(0, 1, 2, 3, 4, 7, 8, 9), c = Σm(0, 1, 3, 4, 5, 6, 7, 8, 9), d = Σm(0, 2, 3, 5, 6, 8, 9), e = Σm(0, 2, 6, 8), f = Σm(0, 4, 5, 6, 8, 9) and g = Σm(2, 3, 4, 5, 6, 8, 9), each with don't-cares at 10 to 15.

The engine computes the same table from those lists. It has no X, so it shows the codes 10 to 15 as blank, all segments off, and the first column marks which rows are real digits:

Truth table: valid BCD, a, b, c, d, e, f, g
#DCBAvalid BCDabcdefg
0FALSEFALSEFALSEFALSETRUETRUETRUETRUETRUETRUETRUEFALSE
1FALSEFALSEFALSETRUETRUEFALSETRUETRUEFALSEFALSEFALSEFALSE
2FALSEFALSETRUEFALSETRUETRUETRUEFALSETRUETRUEFALSETRUE
3FALSEFALSETRUETRUETRUETRUETRUETRUETRUEFALSEFALSETRUE
4FALSETRUEFALSEFALSETRUEFALSETRUETRUEFALSEFALSETRUETRUE
5FALSETRUEFALSETRUETRUETRUEFALSETRUETRUEFALSETRUETRUE
6FALSETRUETRUEFALSETRUETRUEFALSETRUETRUETRUETRUETRUE
7FALSETRUETRUETRUETRUETRUETRUETRUEFALSEFALSEFALSEFALSE
8TRUEFALSEFALSEFALSETRUETRUETRUETRUETRUETRUETRUETRUE
9TRUEFALSEFALSETRUETRUETRUETRUETRUETRUEFALSETRUETRUE
10TRUEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
11TRUEFALSETRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
12TRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
13TRUETRUEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
14TRUETRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
15TRUETRUETRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE

Computed by the Tangibool engine

The seven expressions, with don't-cares

Each segment gets its own Karnaugh map, with D C down the side and B A across the top, both in the Gray-code order 00, 01, 11, 10. The six cells for codes 10 to 15 are marked X. An X may join a group if that makes the group larger, and may be left out otherwise. Using them is what makes the expressions short.

The expressions below are the covers the engine's Karnaugh map derives with codes 10 to 15 as don't-cares. A design that uses the don't-cares agrees with the truth table on the ten digits, not on all 16 codes, so each check asks: if the code is a valid digit, does the expression give the table's value? The truth table generator answers on all 16 rows.

SegmentExpressionGroups on the mapCheck
aD + B + C·A + C′·A′D, B, C·A, C′·A′valid digits agree
bC′ + B′·A′ + B·AC′, B′·A′, B·Avalid digits agree
cC + B′ + AC, B′, Avalid digits agree
dD + C′·A′ + C′·B + B·A′ + C·B′·AD, C′·A′, C′·B, B·A′, C·B′·Avalid digits agree
eC′·A′ + B·A′C′·A′, B·A′valid digits agree
fD + C·B′ + C·A′ + B′·A′D, C·B′, C·A′, B′·A′valid digits agree
gD + C′·B + C·B′ + B·A′D, C′·B, C·B′, B·A′valid digits agree

Notes on the groups:

  • Segment c is off only for 2, so its map is almost all 1s. Three large groups cover it: everything with C = 1, everything with B = 0, and everything with A = 1. Among the digits, only 0010, the digit 2, falls outside all three.
  • Segment e is on only for 0, 2, 6 and 8, all even digits, which is why both of its terms contain A′.
  • The single term D appears in a, d, f and g. D = 1 only for 8 and 9 among the valid codes; with the don't-cares, the whole bottom half of the map can be one group of eight.
  • Segment d keeps a three-literal term, C·B′·A, for the digit 5. Its only usable neighbour is the don't-care 1101, so its group is a pair.

The segment a worked example draws its map with the X cells marked and the groups shaded.

What the don't-cares buy

Without them, the expressions have to give 0 on the codes 10 to 15, and they get longer. Segment c shows the effect: C + B′ + A is right for every digit, but on the code 1011 (eleven) it gives 1 while the plain minterm list gives 0. The equivalence checker finds exactly that row, D = T, C = F, B = T, A = T, and reports the two as different. Since 1011 never reaches the decoder, the difference never shows, and the shorter expression is safe.

How the tails on 6, 7 and 9 change the logic

Fonts differ on three digits: 6 may be drawn with or without segment a on top, 9 with or without segment d at the bottom, and 7 with or without segment f on the left. Each choice moves one minterm, and the expressions change:

ChoiceSegmentMintermsExpressionCheck
6 without a taila0, 2, 3, 5, 7, 8, 9D + C′·B + C′·A′ + C·Aagrees on valid digits
9 without a taild0, 2, 3, 5, 6, 8C′·A′ + C′·B + B·A′ + C·B′·Aagrees on valid digits
7 with a tailf0, 4, 5, 6, 7, 8, 9D + C + B′·A′agrees on valid digits

Dropping the tail of 6 breaks the large group B in segment a; dropping the tail of 9 removes the group D from segment d; and adding a tail to 7 lets segment f use the whole C = 1 half of the map, which shortens it from four terms to three. So the font is a design decision with a cost in gates. A display without tails on 6 and 9 is also harder to read: its 6 can be mistaken for a lower-case b, and its 9 for a q.

The classic TTL decoder chips, the 7447 and 7448, draw 6 and 9 without tails, which is why the digits on old equipment look that way.

Common anode: the active-low outputs

A common-anode display needs each output to be 0 when its segment should light. Each output is then the complement of the expression above, and it is easiest to design from the 0s of the segment. Segment a is off only for the digits 1 and 4, so its active-low output is 1 for 0001 and 0100:

a′ = D′·C′·B′·A + C·B′·A′

The digit 1 has no neighbour that is a 0 of segment a or a don't-care, so it keeps all four literals; the digit 4 pairs with the don't-care 1100. The truth table generator confirms that on every valid digit this is the complement of segment a.

The circuit

Each segment is an OR of a few AND terms, so the decoder is seven small sum-of-products circuits that share their inputs and the inverted inputs D′, C′, B′ and A′. Several terms repeat across segments, and a circuit builds each one once:

  • C′·A′ appears in a, d and e.
  • B·A′ appears in d, e and g.
  • D appears alone in a, d, f and g.

With the shared terms built once, the whole decoder fits in a few dozen gates. Decoder chips also add a lamp-test input that lights every segment, and a blanking input that turns them all off, often used to blank leading zeros in a multi-digit display.

Common mistakes

  1. Mixing up common anode and common cathode. A decoder with active-high outputs on a common-anode display lights exactly the wrong segments.
  2. Forgetting the don't-cares. Treating codes 10 to 15 as 0 gives correct but longer expressions.
  3. Assuming the expressions work for 10 to 15. With don't-cares the decoder shows odd patterns on those codes; if bad input is possible, blank it explicitly.
  4. Swapping the bit order. D is the 8 bit and A the 1 bit here. Books that call the most significant bit A have the same expressions with the letters reversed.
  5. Copying a truth table drawn in a different font. Check how 6, 7 and 9 are drawn before using someone else's expressions.

Try it yourself

  1. Write a segment as a minterm list, for example Σm(D, C, B, A; 0, 2, 6, 8) for segment e.
  2. To check a simplified expression that uses the don't-cares, type “valid digit implies they agree” into the truth table generator: NOT (D AND (C OR B)) -> (((NOT C AND NOT A) OR (B AND NOT A)) <-> Σm(D, C, B, A; 0, 2, 6, 8)). A tautology means the expression is right on every digit.
  3. The Karnaugh map solver maps the minterm list as written, with codes 10 to 15 as 0s, so its expressions are longer than the ones above; the segment a worked example shows the map with the don't-cares.

Frequently asked questions

What is a BCD to seven-segment decoder?

A circuit that converts a 4-bit binary-coded decimal digit into the seven signals that light the segments a to g of a display, so the digit appears as a numeral.

What is the truth table of a seven-segment display?

Ten rows, one per digit 0 to 9, with the four input bits and the seven segment outputs. Codes 10 to 15 are not digits and are don't-cares.

What are the segments of a seven-segment display?

a is the top bar, b the top right, c the bottom right, d the bottom, e the bottom left, f the top left and g the middle.

What is the difference between common anode and common cathode?

In a common cathode display the segment diodes share a ground connection and light when driven high. In a common anode display they share the supply and light when pulled low.

Why are codes 10 to 15 don't-cares?

BCD only uses the codes 0000 to 1001, so the decoder never receives 1010 to 1111. Its outputs there do not matter, and the designer can choose them to simplify the logic.

What is the expression for segment a?

With codes 10 to 15 as don't-cares and D as the 8 bit, a = D + B + C·A + C′·A′.

Which decoder chips drive seven-segment displays?

The 7447 has active-low outputs for common-anode displays, and the 7448 and the CMOS 4511 have active-high outputs for common-cathode displays.

Written by Muaz Notiar. The Tangibool engine (semantics tangibool-semantics/1, engine 1.0.0) computed the truth table marked “Computed by the Tangibool engine”, and the 13 tool results the guide links to were re-run through the tools' own code in the build of and match what the text says. © 2026 Foreranger LTD.