If you open Tor Browser's circuit display on five different sites, the middle and exit relays will change every time and the first relay won't. That first relay is your guard, and Tor will keep using it for a couple of months or more. This surprises people who assume more randomness must mean more anonymity. Here it's the opposite.

The reasoning, with numbers you can do in your head

Suppose some fraction of the network's entry capacity is run by an adversary who also watches a matching share of exits. If they ever see both ends of one of your circuits, they can probably link you to what you were doing through timing (that's the correlation problem). Now compare two clients.

Client A picks a fresh random entry relay for every circuit. It builds hundreds of circuits a week. Even if the adversary controls only a small slice of entry bandwidth, Client A will land on one of their relays eventually, and probably fairly soon. Over time the probability of never being observed falls towards zero.

Client B picks one entry relay and sticks with it. If that relay is honest, the adversary never gets to see Client B's entry side at all, however long it uses Tor. If it's malicious, Client B is exposed a lot. But the chance of that bad draw is roughly the adversary's share of guard bandwidth, and it doesn't grow with time.

For an individual, being profiled some of the time is often as bad as being profiled all of the time: one linked session can be enough. So Tor chooses Client B's strategy. You take one lottery ticket rather than hundreds. The paper that pushed this, and the later work by the Tor developers on reducing the number of guards from three to one (around 2014), are both cited in the guard specification.

What else guards protect against

There's a second reason that's easier to see. Without guards, an attacker who runs a relay can wait for you to pick it as your first hop and immediately learn your IP address and the fact that you use Tor. With guards, they only get that chance when you rotate, which is rare. It also limits what a malicious relay can learn about the shape of your usage over long periods.

Onion services get even more out of this. A service that picked a new first hop for every circuit could be forced to build circuits on demand by an attacker, who would then just wait until one of their relays was chosen. That attack is called guard discovery, and for onion services the defence has been extended to the second and third hops too, via vanguards.

Earning the Guard flag

Not every relay can be a guard. The directory authorities assign the Guard flag based on things they can observe:

  • The relay has been known to the authorities for a while (on the order of a week or more).
  • Its weighted fractional uptime is high: it doesn't drop offline often.
  • It has the Stable and Fast flags, and its measured bandwidth is above a threshold relative to the rest of the network.

The exact thresholds are computed by each authority and they shift as the network changes, so don't treat any single number you read online as fixed. A new relay operator will notice that their relay gets the Guard flag after about a week or so and then sees its traffic dip for a while, because clients only pick new guards gradually as old ones expire. The Tor Project's old "lifecycle of a new relay" blog post describes this well, and it still roughly matches what operators see.

How the client chooses and rotates

Modern Tor (the algorithm landed in 0.3.0) keeps a few lists in its state file. A sampled set of guards drawn from the consensus, weighted by bandwidth. A filtered subset that is usable right now under your configuration (say, if you've restricted yourself to port 443 or to bridges). And a list of confirmed guards, ones you've actually built a circuit through successfully. It uses the first reachable confirmed guard as its primary.

Guards expire. Each one gets a randomised lifetime when it's sampled, and confirmed guards are kept for a minimum period after confirmation, so in practice most people end up with the same guard for somewhere in the range of a few months. The precise lifetimes are set in the spec and can be tuned by consensus parameters, which is why I'm not going to quote a single figure.

If your primary guard goes down, Tor falls back to the next one on the list and keeps trying the primary periodically. A guard that's down for long enough gets dropped. This fallback is one of the more fragile parts of the design. A local attacker who can block your connection to the guard can push you onto another one, and the guard algorithm has protections that limit how far down the list it will go before it stops and assumes the network is the problem, not the guards.

Where the guard lives on your disk

On a Linux system tor install the state file is usually at /var/lib/tor/state. In Tor Browser it's inside the browser folder under TorBrowser/Data/Tor/state (the layout varies a little by platform). The guard entries look like this, trimmed:

Guard in=default rsa_id=<40 hex chars> nickname=SomeRelay sampled_on=2026-06-02T10:14:00 ... confirmed_on=2026-06-03T08:20:11 confirmed_idx=0 ...

Deleting this file resets your guards. That's occasionally useful when debugging, but it throws away the property described above, so don't make a habit of it. Tails is a special case: because it forgets everything at shutdown, it picks a new guard each session unless you use Persistent Storage for Tor's state. That's a known trade-off of an amnesic system, documented by the Tails developers.

Should you pin a guard?

You can set EntryNodes in torrc to force a particular relay or country. Almost nobody should. Pinning to a small set makes you easier to fingerprint, removes the bandwidth weighting that keeps load balanced, and if the relay you trust goes away you'll fail closed or open depending on StrictNodes. The only common legitimate case for choosing your own first hop is using a bridge, and in that setup the bridge simply takes the guard's place.

#guard-relays #tor-network #anonymity #entry-guards