Onion routing provides anonymity to users on the internet. It works by encrypting data multiple times and routing it through several intermediate servers, known as onion routers, hiding the origin and destination from each router. When a user wants to communicate anonymously, onion routing first establishes a encrypted circuit through the routers. It then opens a stream through this circuit to send data back and forth between the user and destination while preserving anonymity. Each router only knows the previous and next hops in the circuit, not the complete path. Periodically, new circuits are formed to further improve anonymity.