Lab

D Flip-Flop Built from NAND Gates (Positive Edge, Master-Slave)

A positive-edge D flip-flop made of NAND gates: a master latch and a slave latch. Click D and CLK and watch Q copy D only when the clock goes from 0 to 1.

Preview of D Flip-Flop Built from NAND Gates (Positive Edge, Master-Slave)
Open in the lab Embed Run the circuit right here. To edit it in the full lab, sign in; free accounts have a time limit there.

D Flip-Flop Explained: Truth Table, Circuit and Timing

Teaching with circuits?

Create a classroom, give your students a circuit to build, and review what they submit. Try it free with one classroom and up to 5 students.

Try the free classroom demo

How it works

Click the D and CLK inputs to switch them between 0 and 1. Q changes only when CLK goes from 0 to 1, and then it copies D. While CLK stays at 0 or at 1, changing D does not change Q.

The circuit is two gated D latches built from NAND gates. The master latch follows D while CLK is 0; the Master Q output shows it. When CLK rises, the master holds its value and the slave latch passes it to Q. Two NAND gates with their inputs joined work as inverters for the clock, and two buffers delay the master output and Q by one gate so the circuit starts in a steady state.

What's inside

  • 17× Logic Gate

Tags

About

By Samir Sabri
Saved November 19, 2026
9 views
Page: dcaclab.com/circuits/88037-d-flip-flop-built-from-nand-gates-positive-edge-master-slave

Embed this circuit

<iframe src="https://dcaclab.com/experiments/88037-d-flip-flop-built-from-nand-gates-positive-edge-master-slave/iframe" width="560" height="410" frameborder="0"></iframe>

Cite: Sabri, S. (2026). D Flip-Flop Built from NAND Gates (Positive Edge, Master-Slave). DCACLab. https://dcaclab.com/circuits/88037-d-flip-flop-built-from-nand-gates-positive-edge-master-slave

Related circuits