In the 802.11 protocol, the fundamental medium access mechanism is called Distributed Coordination Function (DCF). In DCF, before making any transmission attempt, the nodes count down a timer with a value randomly selected from the Contention Window (CW) size. If the transmitted packet is involved in a collision, the node increases the CW size in an attempt to reduce the collision rate. Conversely, if the packet is transmitted successfully, the node reduces the CW size in order to increase the frequency of the transmission attempts. The growth or reduction in the CW size has a critical effect on the network performance. Several backoff algorithms have been proposed to improve the system throughput. However, none of these methods enable the system to approach the theoretical maximum throughput possible under DCF. Accordingly, this study proposes the Rapidly Adaptive Collision Backoff (RACB) algorithm, in which the CW size is adjusted dynamically based on the collision rate, as analyzed by a mathematical model. Notably, RACB requires no knowledge of the number of nodes in the wireless network and is applicable to both lightly loaded and heavily loaded networks. The numerical results show that, by adjusting the CW size such that the collision rate is maintained at a value close to 0.1, RACB enables the system throughput to approach the maximum DCF throughput in wireless environments containing any number of nodes.