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

7474 (74LS74, 74HC74): the dual D flip-flop chip, live

The 7474 is a 14-pin chip with two independent positive-edge-triggered D flip-flops, each with an active-low preset (PRE) and clear (CLR): on a rising edge of CLK, Q takes the value of D, while PRE = 0 forces Q to 1 and CLR = 0 forces it to 0 at any time. The 74LS74 and 74HC74 share this pinout. This live chip has both flip-flops.

Each flip-flop here is built the way TI's SN74LS74A datasheet draws it: six 3-input NAND gates (each one an AND feeding a NAND in this simulator), three latches working together so that only the clock's rising edge can change Q. Preset and clear go straight into the NAND gates, which is why they act immediately, without waiting for the clock, and why holding both low at once forces Q and Q' both to 1, a state the datasheet calls nonstable because it does not survive releasing them. TI lists two uses that show what the chip is for: dividing a clock by 2 or 4 (wire Q' back to D and each flip-flop toggles on every edge, as in the frequency divider) and turning a momentary push button into an on/off toggle. Here CLK is a plain switch, so you clock the flip-flops by hand. The live chip opens with both flip-flops held clear (1CLR = 2CLR = 0): set CLR to 1, choose D, then turn CLK on to clock it in. Before the page is built, the flip-flop design is checked through 17 steps on its own (presets, clears, edges, holds and the nonstable state), and the chip through a 15-step sequence on all four outputs.

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 flip-flop n, inputs nD, nCLK, nPRE and nCLR and probes nQ and nQbar.
  2. Build each flip-flop from six 3-input NAND gates: two form the input latch that steers a set, two the latch that steers a reset, and two the output latch that holds Q and Q'.
  3. Feed PRE into the set side and CLR into the reset side of all three latches, so either one acts at once.
  4. Set CLR = 1 and PRE = 1, put a value on D, and turn CLK on: Q takes D on the rising edge and ignores D until the next one.

7474 function table (each flip-flop)

PRECLRCLKDQQ'
01XX10
10XX01
00XX1 (nonstable)1 (nonstable)
11rising110
11rising001
110Xno changeno change

7474 pinout

PinNamePinName
11CLR (active low)14VCC
21D132CLR (active low)
31CLK122D
41PRE (active low)112CLK
51Q102PRE (active low)
61Q'92Q
7GND82Q'

X means the input does not matter. The function table and the 14-pin DIP and SOIC pinout are from TI's SN74HC74 (SCLS094F) and SN74LS74A (SDLS119) datasheets, checked 2026-10-25; the 74HC74 runs from 2 V to 6 V. For the flip-flop on its own, see the D flip-flop and how it differs from a latch in D latch vs D flip-flop.

You can also read the full theory in the lesson on the D flip-flop. 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 chip74HC165 shift registerCD4017 decade counter74LS283 4-bit adder74LS90 decade counter74HC161 4-bit counter

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 7474 dual D flip-flop in the lab →

Frequently asked

What is a 7474?

A 14-pin chip with two independent D-type flip-flops, triggered by the rising edge of their clocks, each with active-low preset and clear inputs and both Q and Q' outputs. It is made as the 74LS74 (TTL) and the 74HC74 (CMOS), among others.

What do PRE and CLR do on the 7474?

They are asynchronous and active low. PRE = 0 sets Q to 1 and CLR = 0 resets it to 0 immediately, whatever the clock and D are doing. Keep both high for normal clocked operation.

What happens if PRE and CLR are both low?

Both Q and Q' go high. TI's datasheet calls this configuration nonstable: it does not persist when PRE or CLR returns high, so the final state is not guaranteed. Avoid releasing both at the same moment.

How do you make a divide-by-2 with a 7474?

Connect Q' to D and keep PRE and CLR high. Every rising clock edge loads the opposite of Q, so Q toggles and its frequency is half the clock's. Chain the second flip-flop from the first's Q to divide by 4.

What is the difference between the 74LS74 and the 74HC74?

The same two flip-flops and pinout. The 74LS74 is TTL for a 5 V supply; the 74HC74 is CMOS, runs from 2 V to 6 V and draws much less power.