Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

BCD to decimal decoder: 4 bits to 10 lines, live

A BCD to decimal decoder turns a 4-bit BCD code B3 B2 B1 B0 into one active output out of ten, Y0 to Y9. Because the codes 1010 to 1111 never occur in BCD, they are don't-cares, so most outputs need only two or three inputs: Y8 = B3 AND NOT B0 and Y9 = B3 AND B0.

A full 4-to-16 decoder would AND all four bits for every output. BCD only uses ten of the sixteen codes, and the six unused ones let the K-maps drop variables: Y2 to Y7 ignore B3 (the only valid codes with B3 = 1 are 1000 and 1001, so for 2 to 7 the low three bits already identify the digit), Y8 and Y9 need only B3 and B0, and only Y0 and Y1 still use all four bits. The cost of that saving is that an invalid code lights a wrong output, for example 1010 lights Y2 and Y8 together, so such a decoder must only see valid BCD. Chips of the 7442 family (TI's SN74LS42, for example) do this job with ten four-input NAND gates, fully decoding all four bits so invalid codes leave every output off. The circuit is the reverse of the decimal to BCD encoder. Compare the full 4-to-16 decoder and the BCD to 7-segment decoder. The ten valid codes are checked before the page is built, and the live circuit starts at 0000, so Y0 is lit.

Big circuit: pinch, scroll or tap + to zoom in, then drag to move around.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

What you need

Step by step

  1. Place inputs B3 to B0 and probes Y0 to Y9.
  2. Write each output's minterm, then use codes 1010 to 1111 as don't-cares to drop variables.
  3. Build Y0 and Y1 from all four bits, Y2 to Y7 from B2 B1 B0, and Y8 and Y9 from B3 and B0.
  4. Count from 0000 to 1001: the lit output walks from Y0 to Y9.

BCD to decimal decoder truth table

B3 B2 B1 B0Active outputEquation
0000Y0B3' B2' B1' B0'
0001Y1B3' B2' B1' B0
0010Y2B2' B1 B0'
0011Y3B2' B1 B0
0100Y4B2 B1' B0'
0101Y5B2 B1' B0
0110Y6B2 B1 B0'
0111Y7B2 B1 B0
1000Y8B3 B0'
1001Y9B3 B0

Codes 1010 to 1111 are not BCD; with these simplified equations they light two outputs at once, so the decoder relies on valid input.

You can also read the full theory in the lesson on BCD. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

Build more parts from gates

half adderfull adderhalf subtractorfull subtractor2:1 multiplexer4:1 multiplexerXOR gate from NAND gates2-to-4 decoderSR latchD flip-flopJK flip-flopT flip-flop4-bit shift register4-bit ripple carry adderD latch1-to-4 demultiplexer4-bit magnitude comparator4-bit ring counter4-bit Johnson counter4-to-2 priority encoder4-bit synchronous counter3-to-8 decoder8-to-1 multiplexer4-bit carry lookahead adderhalf adder from NAND gates2-bit comparatorBCD to 7-segment decoder4-bit up/down counterdecade counter2-bit multiplier4-bit ALU4-bit array multiplierNOT, AND, OR and NOR from NANDNOT, OR, AND and XOR from NORfull adder from NAND gatesSR latch from NAND gatesparity generator and checker4-bit adder/subtractorBCD adder4-bit universal shift registermod-6 counter4-bit ripple counterbinary to Gray code converterhalf adder from NOR gatesfull adder from NOR gates4-bit register with parallel load1011 sequence detectorbinary to BCD converterD flip-flop from NAND gates1-bit ALUCMOS inverterCMOS NAND gateCMOS NOR gatePISO shift registerSR flip-flop from NAND gatesBCD to excess-3 code converterHamming (7,4) code encoder and correctortraffic light controller4-bit barrel shifterCMOS AND gateCMOS OR gateCMOS XOR gate1-bit magnitude comparatorhalf subtractor from NAND gatesfull subtractor from NAND gates8-to-3 encoderGray to binary converter4-to-16 decoderfull adder using 4:1 multiplexersedge detectorserial adder4-bit carry-select adderMealy machine (1011 detector)master-slave JK flip-flop (NAND)half subtractor from NOR gates1-to-8 demultiplexerexcess-3 to BCD code convertervending machine FSM4-bit carry-save adder3-bit synchronous counter (JK)CMOS transmission gatetri-state buffer (CMOS)2-to-1 mux from transmission gatesmod-5 counterflip-flop conversion (JK to D)8-bit ALUdecimal to BCD encoder4-to-1 mux from 2-to-1 muxesXOR gate from NOR gates

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the BCD to decimal decoder in the lab →

Frequently asked

What is a BCD to decimal decoder?

A circuit with four inputs and ten outputs that activates the one output whose number is the BCD digit on the inputs. It is also called a 4-line to 10-line decoder.

Why can a BCD decoder use simpler gates than a 4-to-16 decoder?

Because six of the sixteen input codes never occur in BCD. Treating them as don't-cares lets most outputs ignore one or two of the input bits.

What is the 7442?

A family of BCD to decimal decoder chips. TI's SN74LS42, for example, is built from eight inverters and ten four-input NAND gates and fully decodes all four bits, so every output stays off (high) for an invalid code.

What happens with an invalid BCD code?

In this simplified version, a code such as 1010 activates two outputs (Y2 and Y8). A fully decoding chip such as the SN74LS42 keeps every output off.