digiwleeaLearn
Open the lab →

Flip-flops and latches cheat sheet

The memory elements of digital logic at a glance: SR latch, D latch, D flip-flop, JK, and T, each with its characteristic table, equation, and how it is built.

A latch is level-sensitive (it is transparent while its enable is active), while a flip-flop is edge-triggered (it samples its inputs only at the clock edge). Both store one bit by feeding their output back into their input; the clocking is what differs. Q is the current state and Q+ (Q next) is the state after the trigger.

At a glance

ElementWhat it doesTriggerInputs
SR latchSet drives the stored bit to 1, Reset to 0; with both inputs low it holds its value.Level (asynchronous)S, R
D latch (gated)While Enable is high the output follows D (transparent); when Enable drops it freezes the last value.Level (enable)D, E
D flip-flopSamples D on the clock edge and holds it until the next edge. The workhorse register bit.Edge (clock)D, CLK
JK flip-flopLike an SR flip-flop, but the forbidden J=K=1 case is redefined to toggle, so every input is legal.Edge (clock)J, K, CLK
T flip-flopToggles on every clock edge when T=1, and holds when T=0. The building block of counters.Edge (clock)T, CLK

Each element in detail

SR latch

Q+ = S + R'·Q (with S·R = 0)
SRQ next
00Q (hold)
010 (reset)
101 (set)
11invalid

A cross-coupled pair of NOR gates (or NAND, active-low). Each output feeds back into the other gate, and that loop is what stores the bit.

Full SR latch lesson →

D latch (gated)

Q+ = E·D + E'·Q
EDQ next
0xQ (hold)
100
111

An SR latch with a gate: Enable ANDs D onto Set and D' onto Reset, so it can only change while enabled. Removes the SR invalid state.

Full D latch (gated) lesson →

D flip-flop

Q+ = D
DQ next
00
11

Two D latches in series (master-slave) on opposite clock phases, so the output changes only at the instant the clock edges, never while the clock is steady.

Full D flip-flop lesson →

JK flip-flop

Q+ = J·Q' + K'·Q
JKQ next
00Q (hold)
010 (reset)
101 (set)
11Q' (toggle)

A D flip-flop (or SR) with feedback: J and K are combined with the current Q so that J=K=1 flips the state instead of being invalid.

Full JK flip-flop lesson →

T flip-flop

Q+ = T XOR Q
TQ next
0Q (hold)
1Q' (toggle)

A JK flip-flop with J and K tied together (T), or a D flip-flop whose D is wired to Q XOR T. Chain them and each stage halves the frequency: a ripple counter.

Full T flip-flop lesson →
Latch vs flip-flop is the distinction to keep straight: a latch can change output any time its enable is high (a whole level), so a glitch on D passes straight through; a flip-flop only samples at the clock edge (an instant), which is what makes synchronous designs predictable. Real registers and counters are built from edge-triggered flip-flops. See the D flip-flop lesson and then the register and counter lessons that chain them.
Designing with these: read the tables above forward (inputs to next state) to analyze a circuit. To build one that follows a state diagram you read them backward, an excitation table (what inputs drive a wanted Q to Q+). The T flip-flop is easiest for counters (toggle to advance); the D flip-flop is easiest for registers (next state = the input, no logic).