Binary state encoding gives each state a binary number as its code. A 5-state machine could use S0 = 000, S1 = 001, S2 = 010, S3 = 011, S4 = 100.
Its big advantage is economy: it uses the minimum number of flip-flops, the smallest n with 2ⁿ ≥ N (see flip flops needed). For 5 states that's 3; for 100 states only 7, where one-hot would need 100.
The costs:
- More logic. Every state is a pattern across several bits, so next-state and output logic usually involve all the state bits.
- Unused codes. When N isn't a power of 2, 2ⁿ − N codes are unused. They help as don't-cares, but they must be checked for lock-up.
- Order matters. Which state gets which number changes the equations. Giving neighboring states codes that differ in one bit (a gray code order) often helps.
Counters are the natural fit: a binary counter's states are binary numbers, so the encoding is free.