CD4013 – A Basic CMOS Chip With Two D Flip-Flops

CD4013 Functional diagram

The CD4013 contains two D flip-flops. A D flip-flop stores a 1-bit value and only changes when it receives a clock signal. Specifically, its output pin (Q) changes to whatever is on the input pin D (data) when the clock (CLK) pin goes from LOW to HIGH.

Pin Overview

Pinout for the CD4013 IC
CD4013 Pinout
Pin NamePin #TypeDescription
VDD14PowerSupply Voltage (+3 to +15V)
GND7PowerGround (0V)
Q1, Q21, 13OutputOutputs from the two D Flip-Flops
Q1, Q22, 12OutputInverted outputs from the two D Flip-Flops
CLK1, CLK23, 11InputClock input for the two D Flip-Flops (Rising Edge)
D1, D25, 9InputD (data) input for the two D Flip-Flops
S1, S26, 8InputPreset the Flip-Flop output to 1
C1, C24, 10InputReset the Flip-Flop output to 0
Pin overview for the 4013 IC

What is a D Flip-Flop?

A D flip-flop is a circuit that can store one bit of data. Its output can either be HIGH or LOW. The output changes to whatever is on the data (D) input when the clock goes from LOW to HIGH. Also called on the rising edge of the clock. (Some D flip-flops change on the falling edge instead.)

This means that the D flip-flop only cares about what is on the data (D) input at the moment this transition happens.

D flip-flop symbol with pin descriptions

Some D flip-flops have an inverted clock input, which means the output only changes when the clock goes from HIGH to LOW. This is called on the falling edge.

The D flip-flops in the CD4013 also have Set (S) and Clear (C) pins. These can be used to either set the output to HIGH or reset it to LOW, independently of the clock.

Schematic symbol of a D flip-flop with set and clear pins.

A D flip-flop is often used to create shift registers and binary counters, frequency dividers, simple toggling circuits, and much more. See the circuit example further down for a specific use case.

How To Use The CD4013

To be able to use any of the D flip-flops in the chip, you need to first connect the VDD pin to the positive supply terminal and the GND pin to the negative supply terminal.

You can use a power supply voltage between 3V and 15V. Some versions of the 4013 chip support up to 20V. Check the datasheet of your version of the chip for exact values.

The D (data) pin is where you input the data you want to store in the flip-flop.

Provide a rising edge signal (a signal going from LOW to HIGH) on the CLK pin to store the data from the D pin to the output pin Q.

The output pin Q is always the opposite of pin Q.

Use the S (set) pin to force the output pin HIGH.

Use the R (reset) pin to force the output pin LOW.

4013 functional diagram
The two D flip-flops in the 4013 chip and their pin numbers

CD4013 Example Circuit: Coin Tosser

Here’s an example circuit that you can build with the 4013 Dual D Flip-flop IC – a coin tosser.

The following circuit uses a 555 timer to create a fast-switching clock signal to the flip-flop when you push the button S1.

The inverted output from the flip-flop is connected back to the D input. This means that for each clock pulse, the flip-flop output will be the opposite of what it was. So it will toggle between HIGH and LOW as long as it receives a continuous clock signal.

The LEDs L1 and L2 symbolize the Heads and Tails of a coin. Since one is connected to the normal output and the other to the inverted output, only one of them will be lit at a time.

Coin tosser circuit with IC 4013

To build this circuit you’ll need:

  • A 555 Timer
  • A chip with D flip-flops, such as the CD4013BE
  • A red and green LED (L1, L2)
  • Two 10 kΩ resistors (R3, R4) for the LEDs. (These resistor values depend on your supply voltage)
  • A pushbutton (S1)
  • A capacitor (C1) – any value from 1 nF to 10 µF should work fine
  • Two 1 kΩ resistors (R1, R2)
  • One 10k resistor (R5)
  • Note: Some versions of the 555 Timer require a 0.01µF capacitor from pin 5 down to ground/minus
  • Note: The Set and Clr pins of the D flip flop should be connected to ground to avoid weird behavior from noise

C1, R1, and R2 set the clock frequency from the 555 Timer. Use the following values to create about 48 clock pulses per second (values from our 555 timer calculator):

C1: 10 µF
R1: 1000 Ω
R2: 1000 Ω

R5 is just a pull-down resistor (works similar to a pull-up resistor) to keep pin 4 of the 555 Timer LOW when the button is not pushed. This keeps the 555 Timer in a reset state so that it does not send out any clock pulses.

R5: Can be any value from 10k to 100k Ω

Alternatives and Equivalents for CD4013

You likely find the 4013 IC marked as CD4013, NTE4013, MC14013, HCF4013, TC4013, or HEF4013. Usually with a few extra characters at the end (Ex: CD4013BE).

This has to do with the manufacturer of the chip and the technology used. But the functionality and the pins are the same.

Can’t find any of these chips in your local electronics store? Check out my list of online stores where you can find components and tools for all your electronics projects.

Or try one of the following IC alternatives with D flip-flops:

  • 4174: Hex D-type Flip-Flop
  • 4175: Quad D-type Flip-Flop
  • 40174: Hex D-type Flip-Flop
  • 40175: Quad D-type Flip-Flop
  • 74HC74: Dual D-type Flip-Flop
  • 74HC79: Dual D-type Flip-Flop

4013 Datasheet

Download the PDF datasheet for the IC 4013 here:

CD4013B (Texas Instruments)
HEF4013B (Nexperia)

Go back to the full overview of the 4000-series integrated circuits