
How Tor Onion Services Actually Work
Tor gets its name from “The Onion Router” — a reference to the layered encryption at the center of how it works. Understanding that layering explains both what Tor protects against and, just as importantly, what it doesn’t.
Ordinary browsing: one hop
When you load a normal website, your request goes fairly directly from you to the server. The server sees your IP address. Your ISP sees which server you contacted. There’s one hop, and both ends can see each other.
Tor: three hops, and no single node knows everything
A Tor circuit routes your traffic through three relays — guard, middle, and exit — and encrypts the request once for each hop, nested like the layers of an onion. Each relay peels off exactly one layer, learning only the next hop in the chain:
- The guard node knows your IP address, but not your final destination.
- The middle node knows neither your IP nor the destination — just the previous and next relay.
- The exit node knows the destination, but not who originally sent the request.
No single relay in the path has both your identity and what you’re accessing. That’s the core anonymity property, and it’s why compromising one relay doesn’t break the system — an adversary would need to control both the guard and exit relay for a given circuit and correlate timing to de-anonymize a user, which is exactly the kind of attack real-world Tor research spends a lot of effort defending against.
Onion services: hiding the server too
Regular Tor browsing (the three-hop setup above) hides the client’s identity from the destination server. Onion services go a step further and hide the server’s location too — the whole point of a .onion address.
Here’s the mechanism, simplified:
- A server generates a public/private keypair. The
.onionaddress is derived directly from the public key (that’s why addresses look like random strings — they cryptographically are the key, not a name someone registered). - The server picks a handful of introduction points — ordinary Tor relays — and builds circuits to them, without revealing its real IP to those relays beyond what any Tor circuit already conceals.
- It publishes a small descriptor to a distributed hash table, announcing “here’s how to reach my introduction points” (signed by the same key, so it can’t be forged).
- A client who wants to visit looks up that descriptor, then negotiates a meeting point (a rendezvous point) via one of the introduction points.
- Both client and server build their own independent circuits to that rendezvous point. Traffic flows through it, but the rendezvous relay never learns either party’s real location — it’s just a meeting spot.
The result: the client doesn’t know the server’s IP, the server doesn’t know the client’s IP, and no relay in either path knows both ends. That’s a stronger property than a VPN offers — a VPN just relocates trust to a single company, whereas no single party in a Tor circuit sees the full picture.
What this doesn’t protect against
Onion routing hides who’s talking to whom at the network level — it does nothing about what happens after content arrives at your screen. Logging into an account, filling out a form with your real name, or a browser bug that leaks your real IP through some side channel all bypass Tor’s protection entirely, because the anonymity guarantee is specifically about network-layer metadata, not application-layer behavior. That distinction is the subject of the OPSEC post later in this series.