A race condition or race hazard is the condition of an electronics, software, or other system where the system's substantive behavior is dependent on the sequence or timing of other uncontrollable events. It becomes a bug when one or more of the possible behaviors is undesirable.

Race condition in a logic circuit. Here, t1 and t2 represent the propagation delays of the logic elements. When the input value A changes from low to high, the circuit outputs a short spike of duration (∆t1 + ∆t2) − ∆t2 = ∆t1.

The term race condition was already in use by 1954, for example in David A. Huffman's doctoral thesis "The synthesis of sequential switching circuits".[1]

Race conditions can occur especially in logic circuits, multithreaded, or distributed software programs.