T Flip-Flop Simulator
Simulate a T flip-flop and calculate its next output state from the current Q value, T input and active clock edge. Explore toggle behavior, hold behavior, Q and Q̅ outputs, truth table states and step-by-step flip-flop transitions.
Q(next) = T ⊕ Q(current).
A T input of 1 toggles the stored bit, while T = 0 preserves the existing state.
| T | Current Q | Next Q | Operation |
|---|---|---|---|
| 0 | 0 | 0 | Hold |
| 0 | 1 | 1 | Hold |
| 1 | 0 | 1 | Toggle |
| 1 | 1 | 0 | Toggle |
—
—
What Is a T Flip-Flop?
A T flip-flop is a sequential digital logic circuit that stores one binary bit. The letter T stands for toggle. Unlike a simple combinational logic gate, a flip-flop remembers its current output state and changes that state only when the required clock event occurs.
The T flip-flop is especially useful when a circuit needs to alternate between 0 and 1 on successive clock pulses. For this reason it is commonly used in binary counters, frequency dividers and digital state machines.
How a T Flip-Flop Works
The behavior depends on two values: the T input and the currently stored Q state. When T is zero, the next state remains equal to the current state. When T is one, the next state becomes the opposite of the current state.
T = 0
Current Q = 0
Next Q = 0
Operation = Hold
T = 0
Current Q = 1
Next Q = 1
Operation = Hold
T = 1
Current Q = 0
Next Q = 1
Operation = Toggle
T = 1
Current Q = 1
Next Q = 0
Operation = ToggleT Flip-Flop Truth Table
| T Input | Current Q | Next Q | Q̅ Next | Operation |
|---|---|---|---|---|
| 0 | 0 | 0 | 1 | Hold |
| 0 | 1 | 1 | 0 | Hold |
| 1 | 0 | 1 | 0 | Toggle |
| 1 | 1 | 0 | 1 | Toggle |
T Flip-Flop Characteristic Equation
The next state of a T flip-flop can be expressed with an XOR operation between the T input and current Q output.
Q(next) = T XOR Q(current)
or
Q(n+1) = T ⊕ Q(n)When T = 0, XOR leaves Q unchanged. When T = 1, XOR produces the complement of Q, which creates the toggle behavior.
Example: T = 1 and Q = 0
Suppose the flip-flop currently stores zero and the T input is high. At the active clock edge, the output toggles from zero to one.
T = 1
Current Q = 0
Q(next)
= T XOR Q
= 1 XOR 0
= 1
Next Q = 1
Next Q̅ = 0Example: T = 1 and Q = 1
If the current state is already one and T remains high, the active clock edge toggles Q back to zero.
T = 1
Current Q = 1
Q(next)
= 1 XOR 1
= 0
Next Q = 0
Next Q̅ = 1T Flip-Flop Clock Edge
Flip-flops are normally edge triggered. This means the stored state changes only at a specific transition of the clock signal rather than continuously while the clock is high or low.
A positive-edge-triggered T flip-flop updates on a rising transition from 0 to 1. A negative-edge-triggered version updates on a falling transition from 1 to 0. The logical T/Q relationship remains the same; only the triggering clock transition changes.
Positive edge:
CLK 0 → 1
↑ update Q
Negative edge:
CLK 1 → 0
↓ update QT Flip-Flop as a Frequency Divider
When T is permanently connected to logic 1, the output toggles on every active clock edge. Because Q requires two clock edges to complete one full output cycle, the output frequency is half the input clock frequency.
Clock frequency:
10 MHz
T = 1 continuously
Q frequency:
10 MHz ÷ 2
= 5 MHzMultiple T flip-flops can be chained to create additional divide-by-two stages.
T Flip-Flop in Binary Counters
Toggle flip-flops are closely associated with binary counters. The least significant bit can toggle on every clock pulse, while subsequent stages toggle according to the counter architecture.
Three-bit binary sequence:
000
001
010
011
100
101
110
111Each binary bit can be implemented using state-storage elements such as T flip-flops.
T Flip-Flop vs JK Flip-Flop
A T flip-flop can be considered a simplified form of a JK flip-flop when its J and K inputs are tied together.
JK configuration:
J = T
K = T
When T = 0:
J = 0, K = 0
→ Hold
When T = 1:
J = 1, K = 1
→ ToggleT Flip-Flop vs D Flip-Flop
| Feature | T Flip-Flop | D Flip-Flop |
|---|---|---|
| Main input | T | D |
| Primary purpose | Hold or toggle | Store input data |
| Next-state rule | Q(next) = T ⊕ Q | Q(next) = D |
| Common use | Counters, dividers | Registers, storage |
Uses of T Flip-Flops
T flip-flops are used in digital counters, clock-frequency dividers, event counters, state machines, timing circuits and sequential logic systems. Their simple hold-or-toggle behavior makes them useful wherever a stored binary state must alternate under clock control.
The simulator on this page can also be used for electronics education and digital logic exercises because it shows both the truth-table result and the XOR characteristic equation.