How Does a VPN Work? Step by Step, With a Diagram

Karolina Assi

November 30, 2026

How Does a VPN Work? Step by Step, With a Diagram
💡
TL;DR: When you tap Connect, your device and a VPN server agree on secret keys. From then on, everything your device sends, including DNS lookups, is encrypted and sent to that server, which forwards it to the internet from its own IP address. Your internet provider sees only scrambled traffic to the VPN, and websites see the server, not you.

You tap Connect, the button turns green, and two seconds later you're connecting from Chicago while you're sitting on your couch in London. Nothing on your screen looks different, but a surprising amount of math just happened.

This guide walks through it step by step: what happens to your traffic, your IP address, your DNS lookups and your encryption the moment a VPN connects, and what other people can still see afterward.

How does a VPN work? What happens when you connect

  1. You tap Connect, and the VPN app reaches out to a VPN server.
  2. Your device and the server swap keys in a quick handshake.
  3. Your DNS lookups start going through the tunnel to the VPN's own resolvers.
  4. Every packet is encrypted and sealed inside a new packet addressed to the server.
  5. The server unwraps it and sends it to the website from its own IP address.
  6. Replies come back the same way, encrypted, and your device unlocks them.

But that's the simple version. Here's what actually happens under the hood of each step.

Step 1: You tap Connect

The VPN app on your device is called the VPN client. When you tap Connect, it picks the server location you chose and creates a virtual network interface on your device, a sort of extra network card that only exists in software.

Your operating system is then told to send all internet traffic through that interface instead of straight out to your Wi-Fi or mobile network. In our app, the protocol that handles this by default is WireGuard, a modern VPN protocol built to be fast and lean.

Step 2: The handshake

Before any of your data moves, your device and the VPN server need to prove who they are and agree on secret keys that only the two of them know. Think of it as two people agreeing on a code word in a crowded room, using math that lets them land on the same word without ever saying it out loud.

WireGuard does this in a single round trip. Our apps also add a post-quantum layer on top: an extra key, exchanged using a hybrid method called X25519MLKEM768, that's designed to hold up even against future quantum computers.

The keys are also refreshed regularly, so if someone ever stole one key, it wouldn't unlock your past traffic (this is called Perfect Forward Secrecy, PFS).

Step 3: DNS lookups go through the tunnel

Every time you visit a site, your device first asks a DNS server for its address, like looking up a name in the internet's phone book. Without a VPN, those lookups usually go to your internet provider, which means it gets a tidy list of every site you visit, even if it can't see what you do there.

Once you're connected to our VPN, those lookups travel inside the encrypted tunnel and are answered by our own DNS resolvers. Your internet provider never sees the question, or the answer.

Step 4: Your data gets encrypted and wrapped

Now your actual traffic starts moving. Each piece of data (a packet) still has the website's address written on it, so the VPN client encrypts the whole packet, address and all, and seals it inside a brand-new outer packet. That outer packet has only one address on it: the VPN server's. This is called encapsulation.

Picture a letter inside a locked envelope, inside another envelope addressed to a friend who has the key. The mail carrier, in this case your internet provider or the café Wi-Fi, only ever sees the outer envelope.

Step 5: The VPN server unwraps and forwards

The VPN server receives the outer packet, unlocks it with its copy of the session keys, and finds your original request inside. It then sends that request on to the website, using the server's own IP address as the return address. To the website, the request came from the VPN server, not from you.

If the site uses HTTPS (most do), your content stays encrypted on this final stretch too, so the server is passing along a sealed request rather than reading your messages.

Step 6: Replies come back the same way

The website sends its reply to the VPN server, because that's who asked. The server encrypts the reply, wraps it in a packet addressed to your device, and sends it back through the tunnel. Your VPN client unlocks it and hands it to the app that asked for it, whether that's your browser, Spotify or a game.

All six steps happen on every request, many times a second, and you never notice any of it. Except, maybe, the little green icon.

Diagram: where your traffic goes with a VPN

Without a VPN, your internet provider or the Wi-Fi owner is the middleman for everything. With one, they only carry a sealed tunnel to the VPN server.

So who can see what once you're connected?

Who Sees your real IP? Sees which sites you visit? Sees what you do there?
Your ISP or Wi-Fi owner Yes No, only that you're connected to a VPN server No
The VPN server Yes Technically, while forwarding your traffic No, not for HTTPS sites
The website No, it sees the VPN's IP Yes Yes, as usual

Your internet provider can still see when you're online and roughly how much data you use, just not where it goes. Notice that the VPN doesn't make your traffic vanish; it moves trust from your internet provider to your VPN provider.

That's why a provider's logging policy matters so much, and why ours is a strict no-logs policy.

What Keeps the Tunnel Sealed

The protection comes from two things: the secret keys your device and the VPN server agree on when you connect, and the encryption those keys apply to every packet before it leaves your device. That's why your internet provider, the café Wi-Fi, or the person at the next table running a packet sniffer only see noise. Each packet is also authenticated, so if anyone tampers with it on the way, your device or the server throws it out.

The exact locks depend on the protocol you're using:

  • WireGuard, our default, scrambles your data with ChaCha20, checks it with Poly1305 and agrees on keys with Curve25519, with an extra post-quantum key on top.
  • OpenVPN and IKEv2 use AES-256-GCM, with perfect forward secrecy.
  • Our browser extension uses TLS 1.3, the same standard behind HTTPS websites.

You don't need to memorize any of that; the full list lives on our encryption page, and it's the same strong encryption on every plan.

Because the VPN app works at the operating-system level, that tunnel carries everything your device sends: your browser, apps, games, background updates and DNS lookups. There are three exceptions:

  • The final stretch from the VPN server to the website relies on the site's own HTTPS.
  • Apps you exclude with Split Tunneling skip the tunnel on purpose.
  • A browser extension only covers the browser it's installed in, which we explain in VPN extension vs. VPN app.

What a New IP Address Does for You

The part of a VPN you actually notice is the new IP address: websites see the VPN server's address instead of yours. Since sites guess your location from your IP, they also think you're wherever the server is. That's how you end up "in Chicago" while sitting on your couch in London.

You usually share that server IP with lots of other users, and that crowd makes it much harder to single anyone out. If you need the opposite, like remote workers whose office systems only allow one fixed address, a Static IP gives you an address of your own, at the cost of the crowd cover.

The same trick is how a VPN unblocks websites. A school, office or internet provider can only see traffic going to the VPN server, so its blocklist has nothing to match. Sites that change their content by country show you the version for your server's location. And on networks that try to block VPN traffic itself, our Stealth and WStunnel protocols disguise the tunnel as ordinary web traffic to help get around censorship.

Does It Work the Same on Your Phone and Other Devices?

Yes. A VPN works the same way on every device, with the work split between the VPN client on your device and the VPN server at the other end. On an iPhone or Android phone, the operating system routes every app through the VPN, and the key icon in your status bar tells you the tunnel is up. Turn on auto-connect or always-on VPN so you stay protected as you hop between Wi-Fi and mobile data.

Just remember that a VPN only protects the device it's running on, even if everything shares the same Wi-Fi. Install it on each device, or set it up on your router to cover smart TVs and consoles that can't run VPN apps.

What a VPN Doesn't Protect

A VPN hides your network identity, meaning your IP address, your DNS lookups and the content of your traffic in transit, but it doesn't hide everything else. It changes your address, not your face.

  • Location services. Apps with location permission can still see your phone's GPS.
  • Accounts and cookies. Log in to a site, and it knows it's you.
  • Browser fingerprinting. Sites can recognize your browser from details like screen size and fonts, which is why our browser extension includes anti-fingerprinting tools.
  • WebRTC leaks. This browser feature can reveal your real IP even with the VPN on. Check yours with our WebRTC leak test.
  • Phishing and malware. A VPN isn't antivirus. Our R.O.B.E.R.T. blocker stops many known malicious domains, but a convincing fake login page is still on you.
  • Dropped connections. If the tunnel drops without you noticing, your device falls back to your normal connection and real IP. A kill switch prevents that: on desktop, our Firewall blocks all traffic outside the tunnel until the VPN reconnects, and on phones, the always-on setting does the same job.

The Bottom Line

Under the hood, a VPN does a handful of things very quickly: it shakes hands with a server, encrypts every packet, sends it through a private tunnel, and unwraps the replies when they come back.

On the surface, it keeps your data hidden from your internet provider and anyone else on the network, swaps your IP address and location for the server's, and gets you past blocks on restrictive networks.

Of course, reading about a VPN is a bit like reading about swimming. If you want to see all six steps happen for real, download Windscribe, tap Connect on our free plan, and watch your IP address pack its bags.

Get Windscribe For Free

Frequently Asked Questions

Is a VPN the same as a proxy?

No. A proxy also forwards your traffic through another server and changes your IP, but it usually works for one app at a time, often just the browser, and many proxies don't encrypt anything. A VPN encrypts all of your device's traffic, DNS included, inside a tunnel.

Can my ISP tell I'm using a VPN?

Usually, yes. Your internet provider can see that you're sending encrypted traffic to a VPN server's IP address, and when and how much. What it can't see is which sites you visit or what you do there. On networks that actively block VPNs, stealth protocols disguise that traffic as ordinary HTTPS so it's much harder to spot.

Does a VPN slow down my internet?

A little. Encryption takes a small amount of processing, and your traffic takes a detour through the VPN server, so distance adds some delay. Picking a nearby server and a fast protocol like WireGuard keeps the slowdown small enough that most people don't notice it. On networks that throttle certain traffic, a VPN can even make things faster.

Does a VPN protect me from hackers?

It protects your traffic from people snooping on the network, which is the main risk on public Wi-Fi in cafés, hotels and airports. It doesn't protect your device itself from malware, phishing links or weak passwords. Think of a VPN as a locked tunnel for your data, and keep your device updated and your passwords strong for everything else.

Keep your browsing private and secure by masking your IP address.
Get Windscribe