Computing Library › Digital Logic & Circuits
Digital Logic & Circuits

T Flip-Flop

A T flip-flop toggles its output on each clock edge when its input is high, making it a natural frequency divider.

What it does

A T flip-flop, for toggle, has a single input T. When T is high the output flips on every clock edge; when T is low the output holds. It is the simplest element for counting and dividing frequency.

Behavior table

Kronos motion — when
TQ next
0Q (hold)
1NOT Q (toggle)

How it is made

A T flip-flop is a JK flip-flop with J and K tied together, or a D flip-flop with D wired to NOT Q through the toggle logic: D = T XOR Q. Both give the same toggling behavior.

Frequency division

With T held high, a T flip-flop toggles once per clock edge, so its output completes one full cycle for every two input cycles. This halves the frequency. Chaining n of them divides by 2^n, which is exactly how a ripple counter works.

Uses

T flip-flops build binary ripple counters, clock dividers, and any circuit that needs to alternate state on a repeating trigger.

In code

python
if t:
    q = not q  # on each clock edge