What Is a VPN and How Does It Work? A Comprehensive Guide

Short version up front. A VPN - Virtual Private Network - is an encrypted tunnel between your device and a remote server. It hides your IP and shields your traffic from whoever happens to be watching the network in between. As for how a VPN works: your device wraps every packet in encryption, ships it off to a VPN server, and that server forwards the unwrapped traffic onward using its own IP. So the website you're loading, your ISP, the coffee shop router - none of them sees you. They see the server.
This isn't a glossary entry. It's the kind of explainer you'd hope a colleague gave you on a whiteboard. By the end you'll know what's actually happening inside the tunnel, the differences between WireGuard and OpenVPN and IKEv2 (plus which legacy protocols should've been retired ten years ago), eight situations where a VPN solves a real problem, and - the part nearly every guide on page one skips - where it absolutely doesn't help. The global VPN market sits well into the tens of billions of dollars in 2026 and continues to grow at double-digit annual rates, driven mostly by remote work and rising privacy fatigue.
Here's the uncomfortable bit. Plenty of people who pay for a VPN every month have no real idea what they're paying for. So let me put this out there early: a VPN is one layer in a privacy stack. Just one. Skip past that and the rest of this guide can't save you from your own assumptions.
AI Summary
Quick framing. A VPN is software that encrypts your internet traffic and pushes it through a remote server, swapping your real IP for the server's. Two flavors basically - consumer VPN services you subscribe to (NordVPN, Mullvad, ProtonVPN), and corporate VPNs that companies run for remote access or for linking offices. Both lean on AES-256 or ChaCha20-Poly1305 encryption. Both still uncrackable in any practical sense in 2026.
A few things every user should know going in:
- AES-256 - industry-standard symmetric cipher. ChaCha20-Poly1305 is the modern alternative.
- WireGuard - fastest current protocol. Around 4,000 lines of code against ~70,000 for OpenVPN.
- A kill switch blocks all internet access if the VPN tunnel drops. Non-negotiable feature.
- No-logs policy means the provider keeps no connection records. Only worth something when an outside party has actually audited it.
- Split tunneling routes only the apps you choose through the VPN. Everything else stays on the open connection.
- A VPN doesn't make you anonymous - browser fingerprinting, cookies, logged-in accounts still identify you regardless.
- Self-hosted VPNs (WireGuard on your own server) take provider trust out of the picture entirely.
:::
What Is a VPN?
A VPN is an encrypted connection between your device and a server you trust. Every packet leaving your device gets wrapped in encryption and pushed through a tunnel the local network can't read. On the other side, the server peels the encryption off, swaps your IP for its own, and sends it onto the public internet. Everyone outside the tunnel - your ISP, the cafe router, whoever's running the network - sees... not much really. Not your destination. Not your traffic. Not where it came from.
The phrase virtual private network started life describing private corporate links built over public infrastructure. RFC 2764 territory. Consumer VPNs took that same idea and pointed it at individuals on the open internet. The "virtual" part: there's no dedicated wire. The "private" part: cryptography is doing all the isolating.
People mix up VPNs, proxies, and Tor constantly. Worth a quick map of what's what:
| Tool | What It Encrypts | Hides IP | Speed | Trust Model |
|---|---|---|---|---|
| VPN | All OS-level traffic in an encrypted tunnel | Yes | Fast (5–20% loss) | Trust one provider |
| HTTP/SOCKS Proxy | Only the configured app's traffic; often unencrypted | Yes (per app) | Fast | Trust one provider |
| Tor | Three nested encryption layers across volunteer relays | Yes | Slow (high latency) | Distributed; no single party knows source + destination |
| HTTPS only | The application payload to a specific website | No | Fastest | Trust the site's TLS certificate |
A SOCKS5 proxy in your browser hides what the browser sends and nothing else. The OS keeps talking. Background apps keep talking. DNS keeps leaking right out the side. A VPN sits lower in the stack and grabs all of it. Tor goes further on anonymity with three encrypted hops, but you pay for that in speed - and pay heavily. Streaming over Tor? Don't bother even trying.
How Does a VPN Work?
Quick answer first. A VPN does a cryptographic handshake with a remote server, agrees on a shared symmetric key, builds a virtual network interface on your device, then routes every outbound packet through that interface inside an encrypted envelope. The server unwraps each packet and forwards it on. Whatever you're connecting to only ever sees the server's IP. Never yours.
Here's what happens, step by step, from the moment you click Connect:
- Handshake. Client and server authenticate each other and exchange keys. OpenVPN uses TLS for this. WireGuard uses the Noise Protocol Framework. IKEv2 has its own mechanism. Certificates or public keys do the heavy lifting on identity.
- Session key derivation. An ephemeral symmetric key gets generated using Elliptic Curve Diffie-Hellman - usually with Curve25519. That key encrypts your actual data and rotates regularly, which is what gives you forward secrecy.
- Virtual interface. Your OS spins up a virtual network adapter (tun0 or wg0 on Linux, a TAP/TUN adapter on Windows), then rewrites the routing table so the default gateway points at this new interface.
- Packet encapsulation. Every outbound IP packet gets encrypted with AES-256-GCM or ChaCha20-Poly1305, then wrapped inside a UDP packet aimed at the VPN server.
- Server forwarding. Server decrypts. Applies NAT. Pushes the packet onto the public internet using its own IP. Return traffic comes back the same way in reverse.
- Re-keying and teardown. Session keys rotate on a schedule. When you disconnect, keys get thrown away and the virtual interface comes down with them.
Three failure modes matter way more than any of the protocol details. DNS leaks - your domain lookups go to the ISP's resolver instead of through the tunnel. Easy to spot at dnsleaktest.com. WebRTC leaks - your browser hands the real IP to a remote peer even with the VPN running in the background. The kill switch is your safety net for both. Tunnel drops, firewall slams the door on all non-VPN traffic until the connection comes back. Without one, a short reconnect can be enough to expose your real IP to every active session you've got open at that moment.
What Is a VPN Protocol?
Direct definition. A VPN protocol is the ruleset for how the client and server negotiate keys, encrypt data, and frame packets. Your protocol choice maps directly to speed, security, mobile reliability, and which networks the VPN can actually punch through. Six protocols still floating around in 2026 - only three of them belong in a new deployment.
| Protocol | Released | Encryption | Speed | Compatibility | Best For |
|---|---|---|---|---|---|
| WireGuard | 2016 (kernel: 2020) | ChaCha20-Poly1305 | Fastest (~10–15% throughput loss) | All major OSes | Default choice for new setups |
| OpenVPN | 2001 | AES-256-GCM (configurable) | Moderate (~20–30% UDP, ~50%+ TCP) | Universal, including routers and firewalls | Restrictive networks; maximum compatibility |
| IKEv2/IPsec | 2005 | AES-256 | Fast | Native on iOS, macOS, Windows | Mobile devices that switch between Wi-Fi and cellular |
| L2TP/IPsec | 1999 | AES-256 (via IPsec) | Slow (double encapsulation) | Built into most OSes | Legacy systems only - avoid for new deployments |
| SSTP | 2008 | AES-256 over TLS | Moderate | Windows-focused | Corporate Windows environments |
| PPTP | 1999 | RC4 (broken) | Fast but insecure | Legacy only | Do not use - deprecated and compromised |
WireGuard is the right default in 2026. Around 4,000 lines of code - auditable by a single competent engineer in a weekend. Modern cryptography (Curve25519, ChaCha20-Poly1305, BLAKE2s). Kernel-integrated since Linux 5.6. On a standard connection, throughput loss runs 10-15% compared to 20-50%+ for OpenVPN on TCP. The counter-argument for OpenVPN: it can run on TCP port 443, which looks like regular HTTPS traffic and punches through corporate firewalls and restrictive hotel networks that block everything else. IKEv2 earns its place on mobile - it reconnects instantly when switching between Wi-Fi and cellular, where WireGuard requires a manual reconnect or a client-side keepalive workaround. PPTP and L2TP/IPsec belong in a museum.
What Is a VPN Used For?
Eight real use cases - not marketing copy, actual situations where a VPN solves the problem being described.
Remote work access. Corporate VPNs give remote employees access to internal resources - intranet, development servers, internal APIs - without exposing those services to the public internet. The VPN client on the laptop creates a tunnel to the corporate gateway, and the employee's device appears to be on the office network. Every major enterprise remote-access setup runs on this pattern (Cisco AnyConnect, Palo Alto GlobalProtect, WireGuard-based solutions for smaller teams).
Encrypting traffic on untrusted networks. Public Wi-Fi - airports, hotels, coffee shops - is trivially sniffable. A VPN encrypts all traffic between your device and the server, so the network operator sees only encrypted data going to one IP. DNS queries go through the tunnel too, so the local resolver doesn't see your lookups.
IP replacement for geo-restricted content. Streaming services license content per territory. A VPN server in the UK makes you appear to be in the UK. This is the consumer VPN use case most people know. Worth being clear: streaming platforms actively block VPN IP ranges, so not every server works.
Self-hosted infrastructure access. A WireGuard server on a VPS or dedicated machine lets you access home or lab infrastructure without punching firewall holes. SSH into a home server through the VPN instead of exposing port 22 to the internet.
Bypassing censorship. In countries where websites or services are blocked at the ISP level, a VPN tunnels traffic out to an uncensored server. OpenVPN on TCP/443 or obfuscated protocols (Shadowsocks, V2Ray) are harder to detect and block than plain VPN traffic.
Secure site-to-site links. Companies connect office networks over IPsec or WireGuard VPN tunnels rather than leasing dedicated lines. Traffic between offices looks like encrypted packets going to a known IP rather than internal routing.
Reducing ISP data collection. ISPs log DNS queries and connection metadata. A VPN shifts that visibility from your ISP to the VPN provider - useful only if the VPN provider's logging and jurisdiction are better than your ISP's. Which brings up the next section.
Self-hosted VPN for maximum trust. Running WireGuard on your own dedicated server removes the VPN provider from the trust equation entirely. You control the logs (or the absence of them), the jurisdiction, and the configuration. Nobody can be compelled to hand over data they don't hold.
What a VPN Does Not Do
This section is shorter than the "what it does" list but more important per line.
A VPN does not make you anonymous. Anonymity requires that nobody can identify you from your traffic patterns, timing, and behavior. A VPN hides your IP from the destination site and your traffic from the local network. It does not stop browser fingerprinting (canvas, fonts, plugins, screen resolution), tracking cookies, or any session where you've logged into an account. If you're logged into Google while using a VPN, Google knows it's you. The VPN server knows your real IP. The provider knows exactly what server you connected to and when - even if they don't log it, the infrastructure exists.
A VPN does not protect you from malware. If you download and run something malicious, the VPN is irrelevant. The malware already has local execution. The tunnel doesn't stop outbound connections from malicious processes either.
A VPN does not replace HTTPS. End-to-end encryption between your browser and a website is handled by TLS at the application layer. The VPN encrypts the transport between your device and the VPN server - the connection from the VPN server to the destination website is then unencrypted (or encrypted by TLS if the site supports it). Don't confuse the two layers.
A VPN does not protect against account compromise. Stolen credentials, phishing, session hijacking - none of these care what IP you're connecting from.
How to Choose a VPN: Key Criteria
Seven criteria separate trustworthy providers from marketing fronts. The most important one almost never shows up on comparison sites: proof under legal pressure. Anyone can claim no-logs. The real question is what happened when authorities actually showed up at the door.
| Criterion | Why It Matters | Red Flag |
|---|---|---|
| Independent no-logs audit | Proves the policy matches the implementation | Self-attested "no-logs" with no external audit |
| Jurisdiction outside Five/Fourteen Eyes | Reduces exposure to intelligence-sharing demands | Provider HQ in US, UK, Australia without strong legal architecture |
| WireGuard support | Faster, more modern, smaller attack surface | Provider only offers OpenVPN or proprietary protocol |
| Kill switch | Prevents IP leaks during reconnection | App with no kill switch or one that fails open |
| DNS leak protection | Routes all DNS through the tunnel | Verifiable leaks at dnsleaktest.com |
| Open-source client | Community-auditable code, no hidden telemetry | Closed-source binary with vague privacy policy |
| Proven under legal pressure | Real subpoenas tested the no-logs claim | No publicly documented legal events |
Two events define the proof bar here. Back in 2016, Private Internet Access got subpoenaed by the FBI for user data tied to bomb threats. Their response: no logs existed. The criminal complaint itself confirms the only data PIA could provide was a coarse geographic location of the IP cluster. Then April 2023 happened. The Swedish National Operations Department executed a search warrant at Mullvad's Gothenburg office intending to seize customer data. Police walked out empty-handed. The data didn't exist. Two events. Same result. That's the bar any serious VPN comparison should weigh above any feature checklist.
For users who want provider trust out of the equation entirely, a self-hosted VPN on a dedicated server with a privacy-respecting jurisdiction is the zero-trust alternative. You become the provider. You write the policy. There's no third party who could be compelled to hand over what they collected - because there's no third party there to compel.
Summary
A VPN is an encrypted tunnel that swaps your IP and shields traffic from ISPs and untrusted networks. Protocol choice - WireGuard for speed, OpenVPN for compatibility, IKEv2 for mobile - sets the ceiling for performance and security. A VPN is one layer in a privacy stack, not full anonymity. Cookies, fingerprints, logged-in accounts all keep identifying you regardless of what your IP looks like. For people who want the strongest control over logging and jurisdiction, a self-hosted VPN on a dedicated server is the highest-trust option going.
Get a Dedicated Server in Switzerland for Your Self-Hosted VPN
Want to run a self-hosted VPN with full root access, no shared-hosting restrictions, and a jurisdiction that gives your privacy guarantee a real legal floor underneath it? PrivateAlps provides Swiss-based dedicated servers built for exactly this. Switzerland's revDSG framework forbids passive bulk data retention. Targeted disclosure under the BÜPF surveillance act stays possible only with a court order - a much narrower legal threshold than the data-retention directives in most EU and US jurisdictions. With VPN hosting on a Swiss dedicated server you hold the keys, you control the logs, and you decide what - if anything at all - gets retained.
FAQ
What is a VPN?
A VPN is an encrypted tunnel between your device and a remote server. It masks your IP and protects your traffic from anyone watching the local network. Without one on an untrusted network, the operator can read every unencrypted packet and see the destination of every connection you make. With one running, only the encrypted tunnel to the server is visible to anyone outside.
How does a VPN work?
Short version. A VPN does an authenticated handshake with a server, derives a shared symmetric encryption key, then routes every outbound packet through an encrypted tunnel to that server. The server forwards your traffic using its own IP. DNS queries go through the tunnel too - so the ISP can't see which domains you're hitting. Whatever you're connecting to only sees the VPN server. Not you.
What is a VPN protocol?
A VPN protocol is the ruleset governing key exchange, encryption, and data transmission between client and server. Three are worth using in 2026. WireGuard - fastest, smallest codebase, modern cryptography. OpenVPN - most compatible, runs on TCP/443 to bypass restrictive firewalls. IKEv2/IPsec - best for mobile because it reconnects instantly when you switch networks. PPTP and L2TP/IPsec are obsolete.
What is the purpose of a VPN?
Three things mainly. Encrypt traffic so local network operators can't read it. Replace your IP with the server's. Secure connections on untrusted networks like public Wi-Fi. Doesn't anonymize you against logged-in services. Won't patch your software for you. Doesn't block trackers either. Treat a VPN as the network-encryption layer in a broader privacy strategy.
Does a VPN make you anonymous?
No. A VPN hides your IP from websites and your activity from the local network, but anonymity is a different beast entirely. Browser fingerprinting (canvas, fonts, timezone), tracking cookies, and any account you sign into all keep identifying you uniquely. Real anonymity needs Tor plus disciplined operational separation - different identities, different browsers, no logged-in accounts that could connect the sessions back together.
What is a VPN server?
A VPN server is the remote machine that terminates the encrypted tunnel from your device, decrypts your traffic, and forwards it onto the public internet using its own IP. Return traffic comes back through the same tunnel. The server's IP is what websites see. Its location determines your apparent geography.
What is VPN client software?
VPN client software is the program on your device that builds and manages the tunnel - handles the handshake, creates the virtual network interface, enforces the kill switch, routes DNS through the tunnel. Examples: official WireGuard app, OpenVPN Connect, the Mullvad and ProtonVPN clients. Open-source clients are auditable. Closed-source ones aren't.
Is a VPN legal?
VPNs are legal in most countries - US, UK, EU, Canada, Australia, Switzerland. They're restricted or banned in China, Russia, Iran, Belarus, Turkmenistan, and North Korea, where governments either require licensed providers or block VPN traffic outright. Using a VPN doesn't legalize otherwise illegal activity. Copyright infringement and computer fraud are still illegal whether or not you use a tunnel.
What is a no-logs VPN?
A no-logs VPN is a provider that retains no connection timestamps, source IPs, DNS queries, or browsing history. The claim is only meaningful when verified by an independent audit (Cure53, KPMG, PwC). Self-declarations? Just marketing. Jurisdictions outside Five/Fourteen Eyes - Switzerland, Iceland, Panama - face stronger legal barriers to compelled disclosure than US, UK, or EU providers.

