How onion routing separates who you are from what you do.
Tor (The Onion Router) is a volunteer-operated overlay network designed to decouple a user's network identity from their activity. Rather than sending traffic directly to a destination, a Tor client builds a circuit through three relays selected from the public relay directory. Each relay is responsible for a single hop, and the design ensures that no single relay can observe both the origin and the destination of a connection.
The three positions in a circuit have distinct roles. The guard (entry) relay sees the client's real IP address but only encrypted data destined for the next hop. The middle relay knows only the guard and the exit, and carries no information about either endpoint. The exit relay decrypts the final layer and forwards traffic to the destination, so it sees the destination and the plaintext of any unencrypted protocol, but not the client's address. Guards are kept stable for months to limit the number of relays that ever learn a client's IP; middle and exit relays rotate as circuits change.
The term "onion" refers to layered encryption. Before transmission, the client negotiates a separate symmetric key with each relay in the circuit and wraps each packet (called a cell) in three layers of encryption. The guard removes the outermost layer, the middle relay the next, and the exit the last. Because keys are established through an incremental handshake, each relay can only decrypt its own layer, and each learns only the identity of its immediate neighbours in the path.
Relay information is distributed by a small set of directory authorities that jointly publish a signed consensus document listing all relays, their keys, flags, and bandwidth weights. Clients download this consensus and use it to build circuits locally, so relay selection is not controlled by any single party. Circuits are short-lived by design: Tor Browser uses a fresh circuit per first-party site and rotates circuits periodically, which limits the window in which correlation between separate activities is possible.
Tor is not the only design in this space. The table below contrasts it with two commonly compared alternatives: commercial VPNs and the Invisible Internet Project (I2P).