How the Dark Web Works: Onion Routing in Five Layers

Tor wraps your traffic in several layers of encryption and passes it through three volunteer-run relays, so no single relay knows both who you are and what you are visiting. Onion sites go further: visitor and site meet at a rendezvous point, which hides the server’s location too.

Almost every explainer of Tor starts with the same drawing: a person, a line, three computers labelled with padlocks, and a website at the far end. The drawing is not wrong. It is just so simplified that it explains the name and nothing else.

The name is worth keeping, though. Tor stands for The Onion Router, and the onion is not a marketing metaphor. Each relay peels off one layer of encryption and learns only the address of the next relay in line. The last one peels off the final layer and hands your request to the open internet. Nobody in the chain holds the whole picture, which is the entire trick. Everything else — the directory authorities, the circuit building, the rendezvous points — exists to make that trick work at scale without falling apart.

Here is how it actually works, in five layers. If you already know the basics, the interesting parts are layers four and five, where most explanations get vague or wrong.

Five numbered layers of onion routing beside sonar rings showing the user at the centre and guard, middle and exit relays around them
Onion routing in five layers: each relay peels one layer and learns only the next hop.

Layer 1: encryption, wrapped like an onion

When you open Tor Browser and load a page, the browser does not connect to the website. It asks the Tor client running on your computer to build a circuit. Before any traffic leaves your machine, the client has already negotiated a separate encryption key with each relay it plans to use.

Then it wraps the request. The innermost layer is addressed to the exit relay and contains the actual web request. Around that, it wraps a layer addressed to the middle relay. Around that, a layer for the guard relay. Your computer sends the outermost package to the guard.

The guard peels its layer, sees a small instruction — “pass this to the middle relay” — and forwards the rest. The middle relay does the same. The exit relay peels the last layer, sees a plain request for a website, and fetches it. The response comes back the same way, re-wrapped at each hop.

The important consequence is not that the traffic is encrypted end to end. It usually is not, unless the site uses HTTPS. The important consequence is that the encryption is layered so that each relay can only see its neighbours, never both ends of the conversation.

Layer 2: three relays, and what each one can see

Tor uses three relays by default. The number matters less than the division of knowledge, but the roles are specific enough to be worth a table.

Relay What it knows What it cannot see
Guard (entry) Your IP address, and that you are using Tor Which website you are visiting
Middle That traffic is passing through, from one relay to another Who you are or where you are going
Exit The destination, and the contents of unencrypted traffic Your IP address

The guard relay is chosen from a small subset of relays that have been stable and fast for a long time. Tor deliberately keeps the same guard for months rather than rotating constantly, because a constantly changing guard makes certain attacks easier. The middle relay is chosen at random from the larger pool. The exit is chosen from relays that have volunteered to be exits, which is a much smaller and more legally exposed group.

As of November 2026, Tor Metrics and the Tor directory consensus count around 10,600 relays in total, but only a fraction of those are exits. That asymmetry is why exit capacity is the network’s bottleneck, and why running an exit node is a bigger commitment than running any other kind.

Layer 3: circuits, and why they change

A circuit is the three-relay path, plus the negotiated keys, plus state. Tor builds them in advance and keeps them for roughly ten minutes, then rotates to new ones. Multiple requests can share a circuit, but Tor isolates streams by destination so that, for example, two different websites cannot tell they came from the same browser session.

This is where a lot of the practical behaviour comes from. Click a link and the page may feel slow, because three relays in three countries each add latency and none of them are obliged to be quick. Your circuit changing mid-session is normal, and it is why a site that remembered you a moment ago may suddenly treat you as a stranger.

Circuits also explain the most common confusion about Tor’s speed. Throughput is limited by the slowest relay in the chain, not by encryption overhead. A circuit that happens to route through an overloaded volunteer server in a residential basement will be slow. Tor’s design accepts that, because a fast network that leaks who you are would be a worse product.

There is a newer wrinkle worth knowing about. Since 2023, Tor has been rolling out conflux — multi-path circuits that split traffic across two paths and recombine it at the exit. It improves speed and resilience, particularly when one path is congested. The Tor Project says a custom circuit display for these multi-path circuits is coming to Tor Browser Alpha soon, first on desktop and then on Android. If you look at your circuit display and see something more elaborate than three hops, that is why.

Layer 4: onion services and the rendezvous point

Everything so far protects the person browsing. It does not protect the person running the website. An ordinary website has an IP address, and even with Tor in front of it, someone who can watch the server’s traffic long enough can find it.

Onion services solve the other half of the problem. A .onion address is not a domain name pointing at an IP. It is a public key, encoded in base32, and the server that holds the matching private key is the only machine that can answer for it. There is no DNS lookup and no IP address in the address itself.

The connection works like this. The service publishes an introduction point: a relay it has chosen, described in a signed descriptor published to the network’s hash ring. When you request the onion address, your Tor client picks a random relay and asks it to act as a rendezvous point. It then uses an introduction circuit to tell the service “someone wants to meet at this rendezvous point”, without revealing who you are. The service builds its own circuit to that same point. The two circuits meet there.

Each side ends up with a six-hop path — three hops from the visitor, three from the service — and neither side ever learns the other’s IP address. That is why onion sites are hard to take down by finding the server, and why takedowns usually depend on a mistake by the operator rather than on breaking the cryptography.

Layer 5: what Tor cannot hide

This is the layer where honesty matters more than diagrams. Tor hides your IP address from the sites you visit, and it hides your browsing from your internet provider. It does not hide:

  • That you are using Tor. Your provider, and often your government, can see that you are connecting to the Tor network, even if not where you are going. In some countries that is the whole point of blocking it.
  • What you type into a website. Tor is a transport. If you log into an account, the website knows exactly who you are.
  • Files that phone home. A downloaded document that loads a remote image, or a PDF reader that checks for updates, can connect outside Tor and reveal your real address.
  • Global adversaries watching both ends. Tor is designed against an adversary who sees one part of the network. Someone who can watch your connection and the exit relay at the same time has a statistical advantage, especially over long periods.

The one-sentence version: Tor protects the route, not the destination. It stops a website from learning where you are; it does not stop you from telling the website who you are, and it does not stop a file you open from making its own connection.

How a request actually travels: the short version

Put together, a single page load looks like this.

  1. Your browser asks the Tor client for a circuit. The client picks a guard, a middle and an exit from the current consensus, and negotiates keys with each.
  2. It wraps the request three times and hands it to the guard.
  3. The guard removes one layer and forwards it. The middle does the same.
  4. The exit removes the last layer, makes an ordinary HTTPS request, and sends the response back along the same path, re-encrypting at each step.
  5. Your client unwraps the response and hands it to the browser.

For an onion service, steps 2 to 4 change: instead of an exit relay, your client meets the service at a rendezvous point chosen by your client, and the path becomes six hops with no exit to the open internet at all.

Why the design holds up

The reason this survives 20 years of attack is that it fails in a boring way. Each relay is deliberately ignorant, relays are chosen from a public consensus that anyone can audit, and the software is open for inspection. When something goes wrong, it is usually a mistake at the edges — an operator who misconfigured a server, a user who logged in, a browser bug that exposed a fingerprint — rather than the onion routing itself collapsing.

In November 2026, Europol announced 354 arrests following an 18-month operation against dark web vendors and buyers across 14 countries. The operation did not break onion routing. It worked the way these operations usually do: intelligence from earlier takedowns, seized devices, and people who kept using the same habits under a different network. That is the pattern to keep in mind. The cryptography has held up remarkably well; the humans around it have not.

If you want the vocabulary first, the glossary defines each term in a line. If you want the bigger picture, the pillar guide explains what the dark web is, and the darknet explainer covers the other networks — I2P and Freenet — that use the same overlay idea with different trade-offs.

FAQ

Does Tor really use three relays?

Yes, by default: a guard, a middle and an exit. Onion services use six in total, because the visitor and the service each contribute three. Some circuit types, including conflux multi-path circuits, use more.

Can your internet provider see what you do on Tor?

They can see that you are connected to the Tor network, and roughly how much traffic is moving. They cannot see which sites you visit or what you send. If you need to hide that you are using Tor at all, that is what bridges are for.

Is onion routing the same as a VPN?

No. A VPN moves your trust to one company that sees everything. Onion routing splits that knowledge across three volunteers, so no single one can see both ends. A VPN is simpler and often faster; Tor is designed for a different threat model.

Why are onion addresses so long?

A current v3 onion address is 56 characters because it encodes a full 32-byte public key, a 2-byte checksum and a version number. The length is a security feature: it makes addresses effectively impossible to guess or collide, and the checksum means a typo fails instead of leading somewhere else.

Can Tor be broken?

Individual circuits can be deanonymised with enough vantage points and time, and users can be identified through their own mistakes. The network as a whole has not been broken by cryptanalysis in two decades of public scrutiny. Treat claims that a government has “cracked Tor” with the same scepticism as claims that it has cracked end-to-end encryption.

These are the pages most worth reading next, in the order we would read them.

Sources