Wi-Fi CSMA/CA - Backoff, IFS Timing, NAV and RTS/CTS
- A Wi-Fi station senses the channel, waits for it to be idle for a full DIFS (34 us on 5 GHz OFDM), then counts down a random backoff in 9 us slots, and only then transmits.
- Every unicast frame is ACKed after a SIFS (16 us). SIFS is shorter than DIFS, so the ACK always beats any new sender to the channel. No ACK means the sender doubles its contention window (15, 31, 63 ... 1023) and retries.
- Virtual carrier sense closes the gap that listening cannot: each frame's Duration field sets a NAV timer on everyone who hears it, and optional RTS/CTS makes the receiver announce a reservation that hidden stations hear.
- CSMA/CA reduces collisions, it does not remove them: two stations that draw the same backoff still collide. Real efficiency is well under the PHY rate, and falls as stations are added.
Mental model
A meeting with no chair. You wait until the room has been silent for a moment, then count a random few seconds in your head before speaking, so that the three people who were all waiting for the same pause do not all talk at once. If someone else starts while you are counting, you stop counting and resume after they finish. When you finish speaking the person you spoke to says "got it" straight away, before anyone else's pause is long enough to begin. If you hear no "got it", you assume you were not heard, pick from a longer range of seconds, and try again. A person who announces "I am about to give a five-minute update to Sam" also tells people who cannot hear Sam to stay quiet for five minutes.
Where it breaks: a meeting room is one acoustic space, so everyone hears the same silence. On radio, the silence you hear may not be what the receiver hears: a speaker on the far side of the receiver can be inaudible to you and still drown out your message at the receiver (the hidden terminal).
Ethernet's exponential backoff, moved to before sending instead of after. CSMA/CD sends first and backs off when it detects a collision on the wire; a radio cannot detect a collision while it transmits (see Wireless Fundamentals), so CSMA/CA pays the waiting cost up front and uses a missing ACK as the only collision signal. The contention window is the same idea as a retry with jitter in a client library: random delay drawn from a range that doubles on each failure so that competing clients spread out. The ACK plays the role TCP's ACK plays, but at layer 2 and within microseconds.
Where it breaks: a retry library backs off for seconds and gives up after minutes. The 802.11 window tops out at 1023 slots (9.2 ms) and the frame is dropped after only 4 to 7 attempts, then recovery is left to the layers above (retransmission and timers).
How it works
The standard calls this the Distributed Coordination Function (DCF): every station follows the same rules and no one schedules anyone (IEEE 802.11-2020, clause 10.3). The numbers below are for the 5 GHz OFDM PHY (802.11a, and the OFDM modes of n, ac and ax), where the slot time is 9 us and the SIFS is 16 us.
Inter-frame spaces
An inter-frame space is a mandatory idle gap. Shorter gaps mean higher priority, because a station with a shorter wait reaches the channel first.
- SIFS (short IFS) is fixed by the PHY. It is the gap inside one exchange: DATA to ACK, RTS to CTS.
- DIFS (DCF IFS) is what an ordinary station waits before contending:
DIFS = SIFS + 2 x slot. For OFDM at 5 GHz that is16 + 2 x 9 = 34 us. - AIFS (arbitration IFS) is the EDCA version used for QoS:
AIFS[AC] = SIFS + AIFSN x slot, with a differentAIFSNper access category. WithAIFSN = 2it equals DIFS.
| PHY (IEEE 802.11-2020 clause) | Slot | SIFS | DIFS (derived) | CWmin | CWmax |
|---|---|---|---|---|---|
| OFDM 5 GHz (clause 17, 802.11a) | 9 us | 16 us | 16 + 2 x 9 = 34 us | 15 | 1023 |
| HR/DSSS 2.4 GHz (clause 16, 802.11b) | 20 us | 10 us | 10 + 2 x 20 = 50 us | 31 | 1023 |
| ERP-OFDM 2.4 GHz (clause 18, 802.11g), short slot | 9 us | 10 us | 10 + 2 x 9 = 28 us | 15 (31 if 802.11b rates are supported) | 1023 |
The 802.11g row assumes the short slot time, which is only allowed when no legacy 802.11b station is in the BSS; with legacy stations present the slot reverts to 20 us. The 2.4 GHz OFDM SIFS is 10 us, not 16 us, and the PHY adds a 6 us signal extension to the frame. Wi-Fi 4, 5 and 6 devices keep these OFDM timings and change only how much data fits in each frame.
The DCF rules
- Idle on arrival. If the medium has been idle for at least DIFS when a frame arrives, send immediately with no backoff.
- Busy, or just finished. Otherwise wait until the medium is idle for DIFS, then draw a backoff count uniformly from
[0, CW], withCWstarting at CWmin (15). - Count down in idle slots only. The counter drops by one for every 9 us slot the medium stays idle. If the medium goes busy it freezes, and resumes after the next full DIFS of idle. A station never throws away the count it has already waited.
- At zero, transmit.
- Wait for the ACK. The receiver replies after a SIFS if the frame's checksum passed. If no ACK arrives, the transmission is treated as a collision or loss:
CW = 2 x (CW + 1) - 1, draw again, retry. - Success resets CW to CWmin. Broadcast and multicast frames are never ACKed, so they never retry and never grow the window.
Worked example: one 1500-byte frame at 54 Mbit/s
Assume an 802.11a/g-style OFDM link at 54 Mbit/s, no other traffic, and a backoff draw of 7 from [0, 15]. All times are derived from the OFDM PHY (preamble 16 us, SIGNAL field 4 us, then 4 us per symbol; 54 Mbit/s carries 216 data bits per symbol, 24 Mbit/s carries 96) and the figures were checked with a short script.
- Frame size. A 1500-byte IP packet plus 8 bytes LLC/SNAP, a 24-byte data MAC header and a 4-byte FCS is 1536 bytes (an unaggregated, non-QoS data frame; QoS adds 2 bytes).
- Airtime. The PHY adds 16 service bits and 6 tail bits:
16 + 8 x 1536 + 6 = 12310bits. At 216 bits per symbol that isceil(12310 / 216) = 57symbols, so16 + 4 + 57 x 4 = 248 us. - ACK. The ACK is 14 bytes and goes at a mandatory basic rate not above the data rate, 24 Mbit/s here (assuming the BSS basic set includes 6, 12 and 24).
16 + 112 + 6 = 134bits isceil(134 / 96) = 2symbols, so20 + 2 x 4 = 28 us. - Waits. DIFS 34 us, then
7 x 9 = 63 usof backoff, then a SIFS of 16 us between DATA and ACK.
| Step | Duration | Running total |
|---|---|---|
| DIFS | 34 us | 34 us |
| Backoff, 7 slots | 63 us | 97 us |
| DATA | 248 us | 345 us |
| SIFS | 16 us | 361 us |
| ACK | 28 us | 389 us |
The payload is 12,000 bits (1500 bytes) delivered in 389 us, so goodput is 12000 / 389 = 30.8 Mbit/s: 57% of the 54 Mbit/s headline, with one client and no competition. A mean backoff of 7.5 slots gives 393.5 us and 30.5 Mbit/s. The gap is fixed overhead (waits, preamble, headers, ACK), which is why aggregation in 802.11n and later, sending many frames per channel access, matters far more than a faster PHY rate.
Contention window doubling
CW goes 15, 31, 63, 127, 255, 511, 1023: six doublings, then it stays at CWmax. The window is always 2k - 1, so the draw is from 2k values. The worst wait on the first attempt is 15 x 9 = 135 us; on the seventh and later it is 1023 x 9 = 9207 us. The retry counters (below) end the doubling long before most frames get there.
Virtual carrier sense: Duration and NAV
Listening (physical carrier sense) fails when a sender is out of earshot. So every 802.11 frame also carries a 16-bit Duration field: how many microseconds the rest of the current exchange will need. Any station that hears a frame not addressed to it loads that value into its NAV (Network Allocation Vector) timer and treats the medium as busy until the NAV reaches zero, without listening. This is virtual carrier sense. The medium counts as busy if either the radio hears energy or the NAV is nonzero.
For the example above, a DATA frame's Duration is SIFS + ACK = 16 + 28 = 44 us: it reserves the SIFS and the ACK that follow, so overhearing stations stay silent through the ACK without having to decode it.
RTS/CTS
Request To Send (20 bytes) and Clear To Send (14 bytes) add a short reservation handshake in front of a long frame. The sender transmits RTS, the receiver answers CTS after a SIFS, the sender sends DATA after another SIFS, and the receiver ACKs after a third. All five frames are a SIFS apart, so nobody can interrupt. The key is who hears what: the CTS comes from the receiver, so a station hidden from the sender but in range of the receiver hears the CTS and sets its NAV, which is exactly the station that would otherwise have collided at the receiver (the hidden terminal in Wireless Fundamentals).
The Duration values follow from the frame times (RTS and CTS are 28 us at 24 Mbit/s, using the same assumptions as above):
- RTS Duration
= 3 SIFS + CTS + DATA + ACK = 48 + 28 + 248 + 28 = 352 us. - CTS Duration
= RTS Duration - SIFS - CTS = 352 - 16 - 28 = 308 us. - DATA Duration
= SIFS + ACK = 44 us.
The handshake costs RTS + SIFS + CTS + SIFS = 28 + 16 + 28 + 16 = 88 us, taking the exchange from 389 us to 477 us and the goodput from 30.8 to 12000 / 477 = 25.2 Mbit/s, an 18% loss on a clean link in return for protection against collisions on long frames. A collision on a short RTS wastes 28 us; a collision on a 248 us DATA frame wastes 248 us, and much more at lower rates.
The RTS threshold decides when to pay: frames at or below it are sent without RTS/CTS. Most products ship with it at or near the maximum frame size (the standard's range tops out at 2347 bytes), which is effectively off. Check your own device; defaults vary.
Try it: backoff, hidden terminals and RTS/CTS
Step through the events one at a time. With A only you get the no-contention case: DIFS, a random backoff, DATA, SIFS, ACK (389 us when the draw is 7). With A and C hidden from each other and RTS/CTS off, both count down unaware of the other and collide at the AP; turn RTS/CTS on and the AP's CTS puts C into NAV for 308 us. Turn on ACK lost to watch CW go 15, 31, 63, or switch to a shared channel and add stations to see the collision chance climb. The seed replays the same run.
- no events yet, press Next
Deep dive
Why SIFS is shorter than DIFS
Priority is entirely about waiting time. After a DATA frame the receiver waits only SIFS (16 us) before the ACK, while every contending station has to wait DIFS (34 us) plus a backoff. The ACK is on air before anyone else's DIFS has expired, and a CTS or the next frame of a fragment burst gets the same protection. No scheduler or reservation is needed: the shorter interval just wins. EDCA extends the same trick by giving high-priority traffic a shorter AIFS and a smaller window.
Retry limits, ACK timeout and rate fallback
An unACKed frame is retransmitted up to a retry limit: dot11ShortRetryLimit defaults to 7 (frames at or below the RTS threshold) and dot11LongRetryLimit to 4 (frames above it). After that the frame is dropped and the layers above see the loss. Retransmitted frames carry the Retry bit in the Frame Control field, which is what makes loss visible in a capture.
Choosing a lower PHY rate after failed attempts (rate fallback) is not in the standard; each vendor's rate-control algorithm decides. This matters because a retry at a lower rate occupies the channel longer for every station, the airtime cost of a slow client. A 1500-byte frame at 6 Mbit/s takes 20 + ceil(12310 / 24) x 4 = 2072 us, 8.4 times the 248 us at 54 Mbit/s.
After a corrupted frame a station waits EIFS (extended IFS) instead of DIFS to give the unseen ACK time to finish; see clause 10.3 for the exact formula.
Collisions still happen, and get worse with N
Two stations that finish their DIFS at the same time and draw the same backoff transmit together. For two stations starting fresh the chance of a tie is 1/16 = 6.25%. As stations are added, the chance that at least one other station picks the same slot grows, and each collision doubles the windows of the senders involved, which makes everyone wait longer.
Bianchi (2000) modelled this for saturated stations (every station always has a frame) with a Markov chain, giving a fixed point between the per-slot transmit probability tau and the conditional collision probability p:
Here W = CWmin + 1 = 16, m = 6 doublings (16 to 1024), and n is the number of contending stations. Solving that pair numerically (checked with Python) gives:
| Saturated stations n | Collision probability p | Transmit probability tau per slot |
|---|---|---|
| 2 | 0.105 | 0.105 |
| 5 | 0.272 | 0.076 |
| 10 | 0.384 | 0.053 |
| 20 | 0.481 | 0.034 |
| 50 | 0.595 | 0.018 |
With 20 saturated stations, about every second transmission collides, and each collision wastes a whole frame's airtime. The point is the trend, not the third digit: the model assumes the 802.11a window parameters, saturated traffic and an ideal channel, so real networks, with bursty traffic and capture, differ. This is why throughput per station falls faster than 1/n, and why adding clients to one AP slows everyone down.
The capture effect blunts the model in practice: when two frames overlap at the receiver and one is much stronger, the receiver may decode the strong frame and the collision is not a total loss.
Hidden and exposed terminals in practice
RTS/CTS addresses only the hidden terminal. The exposed terminal (B sends to A and C, hearing B, needlessly waits even though C sending to D would not disturb A; see Wireless Fundamentals) is not solved by RTS/CTS: C hears B's RTS, sets its NAV, and still stays silent. Exposed terminals cost capacity, not correctness, and 802.11 accepts that cost.
Even RTS/CTS leaks. The CTS only protects against stations that can hear it, and radio ranges for decoding a frame and for merely sensing energy are different, so some interferers still cannot be told to wait. Interference from non-Wi-Fi devices (microwave ovens, Bluetooth) ignores the NAV entirely.
CSMA/CD versus CSMA/CA
| Aspect | CSMA/CD (Ethernet) | CSMA/CA (Wi-Fi) | Why |
|---|---|---|---|
| Collision handling | Detect while sending, abort, jam, back off | Avoid by waiting a random backoff before sending | A radio cannot hear the channel while it transmits |
| When backoff happens | After a collision | Before every transmission after a busy medium, and after a missing ACK | Cannot detect collisions, so spread out in advance |
| Delivery confirmation | None at layer 2 (the checksum drops bad frames) | ACK after SIFS for every unicast frame | Radio loses frames to noise and fading, not just collisions |
| Window growth | Binary exponential on each collision, up to 10 doublings | CW doubles from 15 to 1023 on each missing ACK | Same idea: spread out under load |
| Where it is used now | Half-duplex Ethernet only, essentially extinct | Every Wi-Fi network | Switched full-duplex Ethernet has no shared medium (switches, link layer overview) |
EDCA: QoS access categories
The 802.11e Enhanced Distributed Channel Access (EDCA) keeps the contention model but runs four queues per station, each a separate small DCF with its own AIFSN and window. Wi-Fi Alliance's certification of this is WMM. The default parameters, for 5 GHz OFDM (slot 9 us, SIFS 16 us), are:
| Access category | Typical traffic | AIFSN | CWmin | CWmax | AIFS = 16 + AIFSN x 9 |
|---|---|---|---|---|---|
| AC_VO | Voice | 2 | 3 | 7 | 34 us |
| AC_VI | Video | 2 | 7 | 15 | 34 us |
| AC_BE | Best effort (default) | 3 | 15 | 1023 | 43 us |
| AC_BK | Background | 7 | 15 | 1023 | 79 us |
A smaller window and a shorter AIFS give voice statistically earlier access: it is a head start, not a guarantee, and a voice frame can still collide with another station's. The AP can advertise different parameters in its beacons. Traffic maps to a category from its 802.1D priority (user priority 0 and 3 go to best effort, 1 and 2 to background, 4 and 5 to video, 6 and 7 to voice), typically set from DSCP. Defaults are in the EDCA parameter set of IEEE 802.11-2020.
OFDMA and the move beyond pure contention
802.11ax (Wi-Fi 6) lets the AP schedule uplink transmissions with a Trigger frame and split a channel into resource units for several stations at once (OFDMA), so many small frames no longer each pay the DIFS, backoff and ACK overhead. Contention still governs the rest of the traffic. Wi-Fi 7's multi-link operation lets a device use more than one band at once, so a busy channel on one link delays it less.
Textbook vs real world
| The textbook says | Production does | Why |
|---|---|---|
| RTS/CTS cures the hidden terminal | Usually left effectively off | The 88 us handshake costs more than it saves on typical frame sizes, and it only helps when hidden terminals are actually the cause of retries |
| Collision avoidance means no collisions | Collisions and retries are constant under load | Equal backoff draws collide, and hidden and exposed terminals are not eliminated, only mitigated |
| Efficiency approaches the PHY rate | Goodput is a fraction of it even with one client | Fixed DIFS, backoff, preamble and ACK overhead, here 57% at 54 Mbit/s, so aggregation is essential |
| Slot, SIFS and DIFS are fixed numbers | They depend on the PHY and band | OFDM 5 GHz uses 9/16/34 us, 802.11b uses 20/10/50 us; mixed networks have to protect legacy stations |
| Stations share the channel equally | Slow clients take more airtime than fast ones | Contention is per frame, not per second, so a 6 Mbit/s client holds the channel 8.4 times longer per frame than a 54 Mbit/s one |
In production
- Disabling low data rates is a standard enterprise tuning step. Management frames such as beacons are sent at the lowest basic rate. A 100-byte management frame takes 992 us at 1 Mbit/s (192 us DSSS long preamble plus 800 us) but only 160 us at 6 Mbit/s (
20 + ceil(822 / 24) x 4), so making 6 Mbit/s the lowest basic rate cuts beacon airtime by about six times. The rate sets and preamble lengths are defined in IEEE 802.11-2020. - Airtime utilisation is the number to watch on a busy AP, not signal strength or client count: channel busy time, retry percentage and the airtime share per client are what dashboards in enterprise controllers expose. Ask your controller vendor for the exact counter names.
- WMM is the Wi-Fi Alliance certification of EDCA, and Wi-Fi 6 (802.11ax) certification covers the scheduled-access features that cut contention for small frames (Wi-Fi CERTIFIED 6).
History and evolution
- 1971 ALOHAnet connects Hawaiian islands over shared radio. Pure random access collides so often that its channel is useful for under about 18% of the time, which motivates listening before sending (ALOHAnet).
- 1976 Metcalfe and Boggs publish Ethernet's CSMA/CD at Xerox PARC: listen, send, detect, back off (Metcalfe and Boggs, CACM). Standardised as IEEE 802.3 in 1983.
- 1997 The first IEEE 802.11 standard defines DCF: radios cannot detect collisions, so CSMA/CA with random backoff, ACKs and optional RTS/CTS replaces CD.
- 2000 Bianchi's model shows how collision probability and throughput depend on the number of saturated stations (Bianchi, IEEE JSAC).
- 2005 802.11e adds EDCA, four access categories with different AIFS and windows, because voice and video need priority that plain DCF cannot give.
- 2021 802.11ax is published, adding scheduled uplink and OFDMA (Wi-Fi 6 certification started in 2019), because dense deployments spent most airtime on contention overhead.
- Now Wi-Fi is a hybrid of contention (DCF/EDCA) and AP-scheduled access (IEEE 802.11-2020 is the edition cited on this page; the current consolidated base standard is IEEE 802.11-2024).
- Next 802.11be (Wi-Fi 7) multi-link operation spreads one device across bands to cut the latency spent waiting for a busy channel.
Hands-on
Capture in monitor mode and look at the control frames. On Linux, put the interface on the channel and in monitor mode first (needs root; the exact method depends on the driver). On macOS:
Open cap.pcap in Wireshark and use these display filters:
The first shows control frames: RTS is subtype 0x1b, CTS 0x1c, ACK 0x1d. The second shows retransmissions; the share of retried data frames is the practical loss number. The third shows RTS only, which on a default network you will usually find none of. Click a frame and read the Duration field in the 802.11 header; that is the NAV value. Captures taken on some adapters omit ACKs, so a "missing" ACK in a capture does not by itself mean it was not sent.
On a Linux client, the driver keeps its own retry counters:
Divide tx retries by tx packets for a retry rate, and note that tx failed counts frames dropped after the retry limit. The output is abbreviated, and the fields available depend on the driver and the iw version. macOS has no equivalent command; use the Wireless Diagnostics tool or a Wireshark capture.
Gotchas
Interview questions
Show answer
Both listen before sending. CSMA/CD (classic Ethernet) sends, detects a collision on the wire while still transmitting, aborts and backs off. A radio cannot hear the channel while it transmits and a collision happens at the receiver, so Wi-Fi uses CSMA/CA: wait for the medium to be idle, count a random backoff, send, and treat a missing ACK as the collision signal.
Follow-ups:
- Where is CD still used? Half-duplex Ethernet, historically on shared coax and hubs; full-duplex switched Ethernet has no collisions to detect.
Show answer
After the medium has been idle for DIFS (34 us on 5 GHz OFDM), a station draws a count from [0, CW] with CW 15 and decrements it once per idle 9 us slot, freezing while the medium is busy. At zero it sends. No ACK means CW goes 15, 31, 63, 127, 255, 511, 1023 and stays there; success resets it to 15. A draw of 7 means 63 us of waiting.
Follow-ups:
- Why random? Stations waiting on the same busy medium would otherwise all send the instant it frees and collide every time.
- Why exponential? The window grows until it is large relative to the number of contenders, so the collision probability falls without knowing how many stations there are.
Show answer
Shorter waiting means earlier access. After a frame the receiver waits SIFS (16 us) to send the ACK, while every contender waits DIFS (34 us) plus a random backoff. The ACK is on air before anyone else may start, so an exchange cannot be interrupted.
Follow-ups:
- Which other frames use SIFS? CTS after RTS, the DATA after CTS, and the frames of a burst; EDCA's AIFS uses the same trick for priority.
Show answer
Every station contends for the same channel, so collision probability rises with the number of stations: in Bianchi's saturated model it goes from about 10% at 2 stations to about 48% at 20. Each collision wastes a whole frame's airtime and doubles the windows involved, so more time goes to backoff and retries, and the total goodput falls while each station's share shrinks faster than 1/n. Slow clients make it worse because they hold the channel longer per frame.
Follow-ups:
- What does OFDMA change? In Wi-Fi 6 the AP schedules uplink resource units for many stations in one transmission, so small frames skip their own contention and overhead.
Show answer
Through EDCA, the 802.11e extension. Each station keeps four queues (voice, video, best effort, background), each with its own AIFSN and contention window. Voice gets AIFSN 2 and a window of 3 to 7, best effort gets AIFSN 3 and 15 to 1023, so voice waits less and draws smaller backoffs. It is probabilistic priority, not a guarantee.
Follow-ups:
- What is WMM? The Wi-Fi Alliance certification of EDCA, with traffic mapped to an access category from its 802.1D user priority or DSCP.
Fun facts
- Ethernet's ancestor ALOHAnet ran over radio, so the contention problem 802.11 solves is where the whole carrier-sense family started.
- Every retransmitted Wi-Fi frame carries a Retry bit in the Frame Control field, so a packet capture shows exactly how lossy a channel is.
- A single 1500-byte frame spends only 248 us of a 389 us exchange sending data at 54 Mbit/s; the rest is waiting and acknowledgement.
- The DSSS long preamble alone is 192 us, nearly ten times the 20 us OFDM preamble plus SIGNAL field, which is why legacy 802.11b rates in the basic set slow down modern clients.
Cheat sheet
- 9 us / 16 us / 34 us - slot, SIFS and DIFS (
16 + 2 x 9) - 15 to 1023 - contention window, doubling per failed attempt
- 20 us / 10 us / 50 us - slot, SIFS and DIFS for 802.11b
- 20 B / 14 B / 14 B - RTS, CTS and ACK frame sizes
- 7 and 4 - short and long retry limits
- 88 us - RTS/CTS overhead in the worked example (389 us to 477 us)
- 57% - goodput as a fraction of 54 Mbit/s for one 1500-byte frame