Right now, as you read this, your laptop or phone is probably on WiFi. It connected automatically, negotiated a speed, authenticated with your router, handled interference from your neighbours’ networks, dealt with your walls and furniture attenuating the signal, and is now delivering packets to your browser at hundreds of megabits per second. All of this happens invisibly, a hundred times a second, and almost nobody knows how any of it works.
WiFi is one of the most successful engineering achievements of the last thirty years. It’s also one of the most underappreciated. This post is about what’s actually happening when your device “just connects.”
The problem WiFi was trying to solve
In the early 1990s, local area networks were built with ethernet cables. Each computer had a network card, a cable running to a switch, and a physical wired path to every other computer on the network. This worked well for offices but terribly for anywhere cables couldn’t go, warehouses, campuses, airports, homes where the router was in a different room from the computer.
A wireless alternative seemed obvious in theory. Radio waves could carry data through the air. The problem was that radio is a shared medium. Every radio in range of every other radio hears everything. On a wire, you can have one device talking on each physical cable. On radio, you have one shared “cable”, the air, and every device has to coordinate with every other device so they don’t talk over each other.
The first attempts at wireless networking in the 1980s and early 1990s were incompatible, slow, and proprietary. Each vendor built their own protocol. None of them interoperated. In 1997, the IEEE published the first version of the 802.11 standard, a common protocol that any vendor could implement, and that any compliant device could use to talk to any other compliant device. That original 802.11 ran at 1 to 2 megabits per second, which sounds pitifully slow today but was usable for email and web browsing on the web of the time.
“WiFi”, the brand name coined by the WiFi Alliance in 1999, is just the consumer-friendly term for 802.11. Every generation of WiFi you’ve heard of (802.11b, 802.11g, 802.11n, WiFi 5, WiFi 6, WiFi 7) is a revision of the same underlying standard.
Radio waves, frequencies, and the spectrum
To understand WiFi, you need to understand a few things about radio.
Radio waves are oscillating electromagnetic fields. They travel at the speed of light and can carry information by varying their amplitude, frequency, or phase. The frequency of a radio wave, how many times per second it oscillates, is measured in hertz. A 2.4 GHz signal oscillates 2.4 billion times per second.
The radio spectrum is a finite, regulated resource. Different frequency bands are allocated for different purposes by national regulators, cellular networks, aviation, broadcasting, satellite communication, emergency services. Most of these bands are licensed; you can’t transmit in them without permission from the regulator.
WiFi operates in unlicensed bands. These are bands that anyone can transmit in, subject to power and behaviour limits, without needing a licence. The three most important ones for WiFi are:
- 2.4 GHz. Used by the earliest WiFi standards and still widely supported. Travels well through walls and has long range, but the band is crowded: it’s shared with Bluetooth, baby monitors, cordless phones, microwave ovens (which leak at 2.45 GHz), and your neighbours’ WiFi networks.
- 5 GHz. Introduced with 802.11a and widely deployed since 802.11n. Higher bandwidth and less congestion than 2.4 GHz, but worse range and more attenuation through walls.
- 6 GHz. Opened for WiFi use starting in 2020-2021, exclusive to WiFi 6E and later. Much less crowded, because older devices can’t use it. Currently the highest-throughput band for consumer WiFi.
Each band is divided into channels, narrow slices of frequency that a particular network operates on. The 2.4 GHz band has eleven or thirteen channels (depending on country), but only three of them (1, 6, and 11 in most regions) don’t overlap with each other. The 5 GHz band has dozens of non-overlapping channels. The 6 GHz band has even more. More non-overlapping channels means less interference, which is why 5 GHz and 6 GHz perform better in dense environments.
The shared medium problem
Here’s the deepest technical problem in WiFi: you cannot talk and listen at the same time on the same frequency.
On a wired network, each cable is a separate physical medium. A device sending on one cable doesn’t interfere with any other cable. On WiFi, every device on the same channel shares the same physical medium, the air. If two devices transmit at the same time, their signals collide and both are garbled. Neither the sender nor the receiver can detect the collision while it’s happening, because the transmitter’s own signal drowns out everything else.
Wired ethernet solved this with a protocol called CSMA/CD. Carrier Sense Multiple Access with Collision Detection. Before transmitting, a device listens to the wire. If nothing is transmitting, it starts. If two devices start at the same time, they detect the collision (because the voltages on the wire are wrong) and back off.
WiFi can’t do collision detection, because it can’t listen while transmitting. Instead, it uses CSMA/CA. Collision Avoidance. The principle is: assume collisions are expensive, and work hard to avoid them rather than detect them after the fact.
The algorithm looks something like this:
- Before transmitting, listen to the channel for a random interval. If the channel is quiet, proceed. If it’s busy, wait until it’s quiet and add a random additional delay (the “contention window”) before transmitting.
- When the channel is quiet and your delay has expired, transmit your frame.
- The receiver, upon receiving the frame, sends back an acknowledgement (ACK) after a very short interval.
- If the sender doesn’t receive the ACK within the expected time, it assumes the frame was lost (possibly due to a collision) and retries, with a longer contention window next time.
The random delays are the crucial part. If two devices both want to transmit when the channel goes quiet, they’ll pick different random delays and one will start first. The other will see the transmission and wait.
This is sometimes called the “politeness protocol.” Every device is trying to avoid stepping on every other device, using randomness and acknowledgement as the coordination mechanism. It’s remarkably effective in practice, but it has a cost: WiFi spends a significant fraction of its airtime on coordination overhead rather than data transfer.
Modulation: turning bits into radio waves
Once a device has the channel, it has to actually transmit the data. This is the job of modulation, encoding digital bits as variations in a radio signal.
Early WiFi used simple modulation schemes that could only encode a few bits per symbol. Modern WiFi uses OFDM. Orthogonal Frequency Division Multiplexing, which splits the channel into many narrow subcarriers and modulates each one independently. This is more resilient to interference and allows much higher data rates.
Each subcarrier uses a modulation scheme like QAM. Quadrature Amplitude Modulation. QAM encodes bits by varying both the amplitude and the phase of a signal simultaneously. A single QAM symbol can represent multiple bits depending on how many distinct amplitude-phase combinations the receiver can reliably distinguish.
- 16-QAM encodes 4 bits per symbol (16 = 2^4 combinations)
- 64-QAM encodes 6 bits per symbol
- 256-QAM encodes 8 bits per symbol
- 1024-QAM (WiFi 6) encodes 10 bits per symbol
- 4096-QAM (WiFi 7) encodes 12 bits per symbol
Higher-order QAM encodes more bits per symbol and is faster, but it requires a much cleaner signal. The constellation of points becomes denser, and any noise or interference can push a symbol into its neighbour’s region, causing errors. This is why your WiFi speed drops when you move away from the router: the signal gets noisier, the modulation falls back to a lower order, and the data rate drops.
Modern WiFi negotiates the modulation continuously based on the current link quality. When the signal is strong, it uses 1024-QAM or 4096-QAM for maximum throughput. When the signal weakens, it falls back to 256-QAM, then 64-QAM, all the way down to BPSK (binary phase shift keying, 1 bit per symbol) in the worst conditions.
MIMO: multiple antennas, multiple streams
Modern WiFi uses multiple antennas at both ends of the connection. MIMO, short for Multiple Input Multiple Output. The idea is that you can transmit multiple independent data streams simultaneously on the same channel by exploiting the way radio waves reflect off walls and furniture to reach the receiver via different paths.
Here’s the intuition. If your router has four antennas and your laptop has two, there are eight possible transmit-receive paths. The signal from each transmit antenna reaches each receive antenna via a slightly different combination of direct and reflected paths. If the transmitter sends a different signal on each antenna, the receiver sees a mathematical combination of all of them. With enough computing power, the receiver can solve for the original signals, effectively getting two, three, or four independent data streams in the same channel.
This is called spatial multiplexing. It’s why WiFi speeds went up so much between 802.11g (54 Mbps, single antenna) and 802.11n (600 Mbps, four antennas). The channel width and modulation improved a bit, but most of the gain came from sending multiple streams at once.
MIMO has a cousin called MU-MIMO (Multi-User MIMO) that lets the router send different streams to different devices simultaneously, useful when you have multiple laptops and phones on the same network. WiFi 6 extended this further with OFDMA, which subdivides channels in the frequency dimension as well as the time dimension, letting the router talk to many devices in parallel in a single transmission slot.
Attenuation and why walls are hard
Radio waves don’t just travel in straight lines through empty air. They reflect, refract, scatter, and attenuate as they pass through materials. Different materials absorb different frequencies at different rates.
A rough guide to WiFi signal attenuation in typical home environments:
- Drywall and wood interior walls: minor loss, 3-5 dB per wall. Not a big deal.
- Brick or plaster walls: significant loss, 6-10 dB per wall.
- Concrete walls: severe loss, 10-20 dB. Two concrete walls can effectively kill your signal.
- Metal (fridge, filing cabinet, metal stud walls): near-total reflection. Signal goes around, not through.
- Water (fish tanks, human bodies in large groups): 2.4 GHz is absorbed noticeably by water, this is the same principle your microwave oven uses. 5 GHz is even more affected.
- Glass: minor loss for clear glass, significant loss for low-emissivity window glass (common in modern energy-efficient windows).
Higher frequencies attenuate more than lower frequencies. This is why 2.4 GHz has better range than 5 GHz, and 5 GHz has better range than 6 GHz, despite all three being “the same” in terms of radio theory. A 6 GHz signal loses much more energy passing through a wall than a 2.4 GHz signal does.
This is also why mesh networking systems work, by placing multiple access points around a house, you ensure every room has a strong signal from at least one AP, and devices roam between APs as they move.
Security: from WEP to WPA3
Early WiFi was shockingly insecure. The original security protocol, WEP (Wired Equivalent Privacy), was introduced in 1997 and broken by academic researchers within a few years. By the mid-2000s, WEP could be cracked in minutes with publicly available tools. Anyone within range of an unsecured or WEP-protected network could read all the traffic and join the network.
WPA (WiFi Protected Access), introduced in 2003, was a stopgap designed to fix WEP’s biggest flaws while still running on existing hardware. WPA2, introduced in 2004, was a major redesign that used AES encryption and a proper handshake protocol. WPA2 was the dominant WiFi security protocol for about fifteen years.
In 2017, researchers disclosed a vulnerability in WPA2 called KRACK (Key Reinstallation Attack) that allowed attackers to decrypt and replay traffic under certain conditions. This accelerated the adoption of WPA3, which uses a newer handshake (SAE. Simultaneous Authentication of Equals) that is resistant to offline dictionary attacks and provides forward secrecy.
WPA3 is the current standard for new devices. Most routers sold in the last few years support it. Many older devices don’t, which is why most home networks run in mixed WPA2/WPA3 mode to stay backwards compatible.
A crucial point: none of these protocols protect you from the operator of the WiFi network. If you’re connected to a café WiFi, the café operator (or anyone who compromises their router) can see which servers you’re talking to, even if your traffic is encrypted with TLS. WPA3 encrypts the link between your device and the router. It doesn’t encrypt what happens after that. For privacy from the network operator, you need a VPN or Tor.
Why WiFi feels unreliable sometimes
All of this complexity adds up to a system that usually works beautifully and occasionally fails mysteriously. Understanding the layers helps explain the failure modes:
- Your WiFi is slow: Probably interference, congestion, or distance. Check how many neighbours are on the same channel. Try switching from 2.4 GHz to 5 GHz. Move closer to the router.
- Your WiFi drops out: Usually roaming problems (the device can’t decide which access point to use), interference from a specific source (microwave, baby monitor, Bluetooth headphones), or a weak signal at the edge of coverage.
- You’re connected but the internet doesn’t work: This is usually a problem beyond WiFi. DNS failure, router NAT table exhaustion, ISP issue. WiFi is working; the layers above aren’t.
- Your phone won’t reconnect to WiFi: Often a DHCP lease expiration, MAC randomisation interacting with the router’s client table, or a stale ARP cache on the router.
Each of these is a separate failure mode at a different layer of the stack. Diagnosing them usually means figuring out which layer is actually broken, which is hard when the consumer-facing abstraction is just “WiFi works” or “WiFi doesn’t work.”
Why WiFi is a miracle
Step back for a moment. When you open your laptop, your WiFi chip is:
- Scanning dozens of channels across two or three frequency bands simultaneously
- Listening for beacon frames from every access point in range
- Negotiating with your chosen network using a cryptographic handshake that resists offline attack
- Agreeing on a modulation scheme based on the current signal quality
- Coordinating its transmissions with every other device on the same channel using a politeness protocol
- Handling reflections off your walls and furniture via MIMO signal processing
- Retransmitting any lost frames and adjusting the modulation order if too many fail
- Roaming to a different access point if you walk between rooms
- Handing off to cellular data if you leave the house, without dropping your active connections
And it’s doing all of this at 1.2 gigabits per second, in a shared spectrum, using consumer-grade hardware that costs a few dollars to manufacture.
That’s not nothing. That’s a staggering achievement, the product of thirty years of engineering refinement, open standards, and a global community of radio engineers, cryptographers, and protocol designers. The fact that it mostly “just works” is the most impressive thing about it.
Next time your WiFi drops out for five seconds in the middle of a video call, spare a thought for everything that had to go right for it to work the other 23 hours and 59 minutes of the day.