Skip to content

Digital Logic

Why a flip-flop clock divider gives a 50% duty cycle

Wire a D flip-flop's Q̄ back to its own D and it toggles: on every rising clock edge it flips. Its output runs at half the clock's frequency. And because it only changes on rising edges, which come exactly once per clock period, the output is high for one whole period and low for the next. That's a 50% duty cycle, however lopsided the incoming clock is.

Divide by 2

On each rising edge the flip-flop copies D, which is the opposite of Q, so Q goes 0, 1, 0, 1. One full cycle of Q, high then low, takes two clock periods:

fout = fin ÷ 2

An 8 Hz clock gives a 4 Hz output; a 16 MHz one gives 8 MHz.

Why the output is always 50%

Take a clock that's high for only a quarter of each period. The flip-flop doesn't care how long the clock stays high: it ignores the falling edge, and a clock held high isn't an edge at all. Only the rising edges count, and they arrive exactly one period apart. So Q holds each value for exactly one period, and its duty cycle is 50%.

Input clock high forOutput high for
25% of each period50% of its period
50%50%
80%50%

Live experiment

Feed a divider a sloppy clock

A clock drives a chain of one, two or three toggling flip-flops. Make the clock even, or high for only a quarter or four fifths of each tick, and watch the scope: the clock goes lopsided, but every output is on for whole ticks and off for as many, a perfect square wave at half the rate.

Try it yourself: free lesson

“Half the beat” is lesson 1 of 6 in Toggle Tides, Digital Logic World 3. Free with an account. Lessons unlock in order, so you’ll do the 14 before it first.

This is why many oscillators run at twice the frequency they need and divide by 2: a crystal oscillator's output is rarely an exact 50%, and the divided clock always is.

Chains divide by powers of 2

Clock a second toggle from the first one's Q̄ and it halves again; n stages divide by 2ⁿ, and every stage's output is a clean 50% square wave. Read the stages together and the chain is a binary counter.

Other ratios

Toggles divide only by powers of 2. For 3, 5 or 10, count the ticks and start again at 0: a divide-by-10 counts 0 to 9. The output repeats every ten ticks, but it's only 50% if the design arranges it: the CD4017 decade counter's carry output, for one, is high for five counts and low for five. Odd ratios need a trick, such as a second flip-flop on the falling edge, to reach an even 50%.

What a divider can't fix

It fixes the duty cycle, not the timing. Every output edge follows an input rising edge, so if those edges wobble, the output's edges wobble with them. And the input's period must be steady: a divider halves whatever rate it's given.

Microcontroller timers run their clock through a divider called a prescaler, dividing 16 MHz by 8, 64 or 256 before counting, and guitar octave pedals use a toggle to halve a note's pitch.

Free lesson

Now build it yourself

Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.

Try it yourself: free lesson

“Half the beat” is lesson 1 of 6 in Toggle Tides, Digital Logic World 3. Free with an account. Lessons unlock in order, so you’ll do the 14 before it first.

Or start from the very first lesson, no account needed

Practice questions

Three quick questions from the lessons. Pick an answer to check it.

  1. Question 1 of 3Q̄ is wired to D, and Q is 1 right now. Just after the next rising edge, Q is…
    Show the answer

    Answer: 0: it copies Q̄, which was 0. D is Q̄, the opposite of Q. With Q at 1, D is 0, and the edge copies that 0 into Q.

    • Why not “1: nothing changes”? D is Q̄, the opposite of what Q holds. With Q at 1, D is 0, and the edge copies that in.
    • Why not “Whatever the switch says”? There's no switch on D here. It's wired to Q̄, so the flip-flop toggles.
    • Why not “Unknown”? Q is a known value and D is a known value, so the edge gives a known result: 0.
  2. Question 2 of 3All three flip-flops are clocked straight from CLK1, each with Q̄ to its own D. SLOW blinks at…
    Show the answer

    Answer: 4 Hz, the same as the first one. Each toggle halves whatever clock it gets. Fed CLK1 directly, all three halve 8 Hz and blink together at 4 Hz. Only a chain multiplies the halvings.

    • Why not “2 Hz”? 2 Hz would need two halvings in a chain. Each stage here only halves the 8 Hz clock once.
    • Why not “1 Hz”? 1 Hz needs each stage clocked from the one before. Clocked together, they never multiply their halvings.
    • Why not “It never changes”? Each one still toggles on every rising edge of CLK1, so SLOW blinks at 4 Hz.
  3. Question 3 of 3You raise the clock and leave it at 1. Now you flip D. Q…
    Show the answer

    Answer: Holds: a clock that stays high isn't an edge. The flip-flop copies D only at the rising edge, the moment the clock goes from 0 to 1. Staying at 1 is not a new edge, so Q keeps what it copied.

    • Why not “Flickers”? Q only changes at a rising edge, and holding the clock high makes no new edges.
    • Why not “Follows D while the clock is high”? That's how a latch behaves. A flip-flop ignores D except at the instant the clock rises.
    • Why not “Goes to 0”? Nothing forces Q to 0. With no new rising edge, it keeps whatever it held.
Keep practising: free lesson

“Half the beat” is lesson 1 of 6 in Toggle Tides, Digital Logic World 3. Free with an account. Lessons unlock in order, so you’ll do the 14 before it first.

Questions people ask

How do I get a 50% duty cycle from a clock that isn't 50%?

Divide it by 2 with a toggling flip-flop: a D flip-flop with its Q̄ fed back to D. The output only changes on rising edges, one per clock period, so it's high for exactly one period and low for the next.

How do I divide a clock by 3?

Count 0, 1, 2 and start again, which takes two flip-flops and a gate to spot the 2. The output repeats every three ticks but is high for one tick and low for two. For an even 50%, add a flip-flop clocked on the falling edge and combine the two outputs.

Does a clock divider remove jitter?

No. Each output edge follows an input edge, so any wobble in when the input's rising edges arrive comes straight through. A divider fixes the duty cycle, not the timing of the edges.

Every topic