Skip to content
BetterDL

Toggle

Also called: toggle mode, toggling, complement mode, toggle operation

To flip a stored bit to its opposite value: 0 becomes 1 and 1 becomes 0. T = 1 on a T flip-flop and J = K = 1 on a JK flip-flop toggle Q.

To toggle a bit is to flip it: Q⁺ = . A 0 becomes 1 and a 1 becomes 0.

Three common ways a flip-flop toggles at a clock edge:

The key fact about toggling: you must know the current Q to know the result. Toggle is relative, unlike set or reset, which always give the same answer.

Why it matters:

  • A flip-flop that toggles every edge produces a square wave at half the clock frequency: a frequency divider.
  • In a binary counter, bit 0 toggles every count, bit 1 toggles when bit 0 is 1, bit 2 toggles when bits 1 and 0 are both 1, and so on.
  • XOR is the gate form of a conditional toggle: equals when T = 1 and Q when T = 0.

Parity shortcut: after k toggles, Q is back where it started if k is even and flipped if k is odd.

Worked examples

Example

Counting toggles

A T flip-flop starts at Q = 1. At seven rising edges T is 0, 1, 1, 0, 1, 1, 1. How many times does Q change, and where does it end?

  1. 1.

    Q changes only at edges where T = 1.

  2. 2.

    T = 1 at edges 2, 3, 5, 6 and 7: five toggles.

  3. 3.

    Q: holds 1 (edge 1), 0 (edge 2), 1 (edge 3), holds 1 (edge 4), 0 (edge 5), 1 (edge 6), 0 (edge 7).

  4. 4.

    Five is odd, so Q ends flipped from its start: 0. It changed 5 times.

Example

JK toggle depends on Q

Two JK flip-flops both receive J = K = 1. One has Q = 0, the other Q = 1.

  1. 1.

    The first toggles 0 → 1.

  2. 2.

    The second toggles 1 → 0.

  3. 3.

    Same inputs, opposite results. Always write down the current Q before applying a toggle.

Common mistakes

  • Treating toggle as "set to 1". It means flip, so from 1 it gives 0.

  • Toggling more than once per edge. A flip-flop toggles at most once per active edge.

  • Forgetting that T = 1 held for many edges keeps toggling Q, rather than holding it at 1.

Practice Toggle

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Toggle is taught in Latches and Flip-Flops and Counters.