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

74HC139 (74LS139): the dual 2-to-4 decoder chip, live

The 74HC139 holds two independent 2-to-4 decoders. In each half, the select inputs B A pick one of four active-low outputs Y0 to Y3, which goes LOW while the other three stay HIGH, as long as the half's active-low strobe G is LOW; G HIGH forces all four outputs HIGH. This live circuit has both halves.

Each half is the 2-to-4 decoder with two changes that real chips almost always have: an enable, and active-low outputs, made here with a NAND of each decoded line and NOT G. Active-low outputs match the active-low chip-select pins of memories and peripherals, which is why TI describes the part as targeted at high-speed memory decoders and data-transmission systems: a 2-bit address picks one of four chips, and the strobe lets a higher address bit enable the whole group. The two halves share only power, so one package can decode two separate address fields, or, with the strobes driven by a third bit and its inverse, act as one 3-to-8 decoder (the job of the bigger 74LS138). B is the more significant select bit. The live chip opens with both strobes low, so 1Y0 and 2Y0 are LOW. All 64 combinations of both halves' inputs are checked before the page is built.

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, for each half n, inputs nG, nB, nA and probes nY0 to nY3.
  2. Decode B A into four lines with NOT gates and ANDs: B'A', B'A, BA', BA.
  3. NAND each line with NOT G for the active-low outputs.
  4. Keep G = 0 and count B A from 00 to 11: the single LOW output steps from Y0 to Y3. Set G = 1 and all four go HIGH.

74HC139 function table (each half)

GBAY0Y1Y2Y3
1XX1111
0000111
0011011
0101101
0111110

74HC139 pinout

PinNamePinName
11G (strobe, active low)16VCC
21A152G (strobe, active low)
31B142A
41Y0132B
51Y1122Y0
61Y2112Y1
71Y3102Y2
8GND92Y3

X means the input does not matter. The function table and the 16-pin pinout are from TI's SN74HC139 datasheet (SCLS108E), checked 2026-10-25; it runs from 2 V to 6 V, and the 74LS139 shares the pinout.

You can also read the full theory in the lesson on decoders. 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 adder4-bit Kogge-Stone adder4-bit carry-skip adder4x4 Wallace tree multiplier8-bit adderfrequency divider (by 2, 4 and 3)switch debouncer (SR latch)3-bit Gray code counterMealy 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 encoderBCD to decimal decoder4-to-1 mux from 2-to-1 muxesXOR gate from NOR gates4-bit LFSR74LS138 decoderBCD subtractor74181 ALUCMOS AOI gate (AOI21)D latch vs D flip-flop74LS47 BCD to 7-segment decoder74HC595 shift register7400 quad NAND gate chip7402 quad NOR gate chip7404 hex inverter chip7408 quad AND gate chip7432 quad OR gate chip7486 quad XOR gate chip7474 dual D flip-flop74HC165 shift registerCD4017 decade counter74LS283 4-bit adder74LS90 decade counter74HC161 4-bit counter74HC151 8-to-1 multiplexer74HC157 quad 2-to-1 multiplexerCD4511 BCD to 7-segment decoder7492 divide-by-12 counter7493 4-bit binary counter74HC244 octal buffer

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 74HC139 dual 2-to-4 decoder in the lab →

Frequently asked

What does the 74HC139 do?

It contains two independent 2-to-4 line decoders. In each, a 2-bit select (B A) drives one of four active-low outputs LOW while the strobe G is LOW; with G HIGH all four outputs are HIGH.

What is the difference between the 74HC139 and the 74HC138?

The 139 is two separate 2-to-4 decoders with one enable each; the 138 is one 3-to-8 decoder with three enables. Both have active-low outputs.

How do you make a 3-to-8 decoder from a 74HC139?

Wire the two halves' B and A inputs together and drive 1G with the third address bit and 2G with its inverse. The first half then decodes addresses 0 to 3 and the second 4 to 7.

Why does the 74HC139 have active-low outputs?

Because the chips it selects, such as memories, usually have active-low chip-select inputs, so a LOW output means selected and can be wired straight to them.