Guide · How it works
What is WireGuard, and how does it work?
WireGuard is the part of a modern VPN that actually seals your traffic, and it's what WrapVPN runs on. You'll never see it, but it decides how quickly you connect, what happens when your phone changes network, and how much there is to go wrong.
TL;DR: WireGuard is a small, open-source VPN protocol. Instead of passwords, every device and server holds a pair of keys. A device proves who it is with one message there and one back, both sides work out fresh session keys, and every packet is sealed with them and checked on arrival. Because the server recognises your device by its key rather than its network address, the tunnel carries on when your phone moves between Wi-Fi and mobile data.
A set of rules, not an app
Start with what kind of thing WireGuard is. It's a protocol: an agreed set of rules for how two machines set up a private channel and send data through it, together with open-source software that follows those rules. Your browser relies on HTTPS in much the same way. You never install HTTPS, yet every padlock in the address bar depends on it.
WireGuard was created by the security researcher Jason A. Donenfeld and first released in the mid-2010s. Versions for Windows, macOS, iOS and Android followed, and in 2020 it became part of the Linux kernel, so the same protocol now runs on almost anything with a network connection.
It was designed as a reaction to older VPN technology, which had grown large and complicated over decades. WireGuard's idea is the opposite: do one job with as few moving parts as possible, so that the whole thing can be read, understood and checked.
To see how it works, we'll follow one example from start to finish: your phone, a VPN server in Frankfurt, and the moment you tap Connect.
Keys instead of passwords
Most things you sign in to ask for a password. WireGuard has no passwords at all. Instead, every device and every server has a key pair: a private key that's kept secret, and a public key that can be shared with anyone.
The two halves are linked by some clever mathematics. If your phone combines its private key with the server's public key, and the server combines its private key with your phone's public key, both arrive at the same secret number. Anyone watching sees only the public keys and can't work the secret out from them, so nothing secret ever has to cross the network.
Before any connection, then, each side is given the other's public key. Your phone knows the Frankfurt server's public key, and the server has your phone's public key on its list of peers, which is WireGuard's word for the machines it will talk to.
That's the whole of WireGuard's idea of identity. Hold the private key that matches a public key on the list, and you're that peer. Don't, and you're nobody: the server won't even reply.
The peer list: who may talk, and as which address
Inside the tunnel, every device has an address of its own, rather like a room number in a hotel. The server's peer list pairs each public key with the inside address that key is allowed to use. WireGuard's author calls this cryptokey routing, and it does two jobs at once.
When the server has a packet for your phone, it looks up which key owns the destination address, seals the packet so that only the holder of that key can open it, and sends it. When a packet arrives, the server opens it first and then checks that the inside address it claims belongs to the key that sealed it. A packet claiming someone else's room number is thrown away.
Because who you are and where your packets may go live in the same short table, the two can't drift apart. There's no separate sign-in step that could say one thing while the routing says another.
Tapping Connect: one message there, one back
Now the tap itself. Your phone needs session keys, short-lived keys used only for this conversation, and it gets them with a handshake of exactly two messages.
First, your phone makes a brand-new key pair just for this handshake. It sends the Frankfurt server a short message containing the new public key, its own long-term identity sealed so that only that server can read it, and a timestamp. The timestamp matters: if someone recorded the message and played it back later, the server would see that it isn't newer than the last one and ignore it.
The server checks that the identity is on its list and the timestamp is fresh, makes a one-off key pair of its own, and replies. Each side then combines its one-off key, its long-term key and the other side's public keys, and both arrive at the same pair of session keys, one for each direction. The session keys themselves never cross the network.
That's the entire handshake. As soon as the reply arrives, your phone can start sending real traffic. There's no menu of options to agree on and no certificate to inspect, which is a big part of why a WireGuard connection comes up so quickly.
The one-off keys are thrown away once the session keys exist. That gives WireGuard what cryptographers call forward secrecy: even if someone later stole a device's long-term private key, it wouldn't unlock traffic they had recorded earlier.
Session keys don't last long, either. While the tunnel is in use, WireGuard runs a fresh handshake every couple of minutes and moves to new keys without interrupting anything, and it refuses keys more than about three minutes old.
Sealing every packet
With session keys in place, every packet your phone sends goes through the same routine. It's encrypted, so nobody else can read it, and given a tamper seal, so any change on the way is detected. Each packet also carries a counter, and the receiver refuses a number it has already seen, so a recorded packet can't be sent again.
The sealed packet is then wrapped in an ordinary internet packet addressed to the Frankfurt server and sent over whatever network you're on. The café's Wi-Fi sees a stream of packets going to one server, how big they are and when they're sent. It can't see what's inside them or where they're ultimately headed.
At the server, the routine runs in reverse. The seal is checked first, and a packet that fails is dropped without a word. Only then is it opened, checked against the peer list and sent on its way to the website.
All of this uses one fixed set of well-studied cryptography, the same on every device:
- Curve25519, for combining keys into a shared secret.
- ChaCha20, for scrambling the contents of each packet.
- Poly1305, for the tamper seal on each packet.
- BLAKE2s, for the fingerprints used while the keys are mixed.
Note
There's nothing to choose and nothing to negotiate. If one of these ever needs replacing, the answer is a new version of the protocol rather than another option on a menu, so there's no weaker setting for anyone to be steered towards.
Changing networks, and staying quiet
Now walk out of the front door. Your phone drops the home Wi-Fi and joins mobile data, and its address on the internet changes completely. Plenty of connections break at this point. WireGuard's doesn't, because the server never cared about your address in the first place; it cares about your key.
When the next packet arrives from the new address, the server checks its seal, sees that it genuinely comes from your phone, and starts sending its replies to the new address. There's no reconnection and no fresh sign-in, and the websites on the far side notice nothing, because they were talking to the server all along.
The same design makes a WireGuard server unusually quiet. It answers nothing that isn't sealed with a key it expects, so to a stranger scanning the internet it looks as though nothing is there at all. Under heavy load it can also ask a sender to prove its return address before doing any expensive work, which blunts floods of fake traffic.
Left alone, an idle WireGuard tunnel sends nothing. That's tidy, but some home routers and mobile networks forget a connection that has gone quiet, so WireGuard can be told to send a tiny keepalive packet every so often. Many VPN apps keep that switched on, and ours do.
What WireGuard leaves to the app, and its limits
WireGuard is deliberately just the tunnel. It doesn't know who you are, whether you've paid, which servers exist or how a new device gets onto a server's list. Everything around the tunnel belongs to the app and the service that runs it:
- Accounts and sign-in: WireGuard knows keys, not people.
- Putting keys in place: someone has to add each device's public key to the right server's list, and give the device the server's.
- Choosing a server: the list of locations, and which one you use, is the app's job.
- Inside addresses and name lookups: the app and the service decide both.
- What happens after the server: once traffic leaves the far end of the tunnel, WireGuard's protection ends, and what the operator keeps is a question for its privacy policy.
Limit
WireGuard travels over UDP, a kind of internet traffic that most networks carry but some strict ones block, and it has no mode that disguises itself as web browsing, so on those networks it can't connect at all. And because a device's private key is its whole identity, there's no password to change: if a key is lost or exposed, the fix is to remove it from the server's list.
Where you meet WireGuard in WrapVPN
You never handle any of this yourself. You sign in with Apple or Google, pick a location and tap Connect. Our servers make sure your device and the exit server you chose know each other's public keys, and WireGuard does everything described above, on iPhone, iPad, Mac, Android and Windows alike.
So the next time your phone connects in a moment, or carries on without a hiccup as you leave the house, that's two messages, a handful of keys and a server that only answers the devices it knows. Install WrapVPN and try it on the free plan's three one-hour sessions a week.
Plans and prices
Weekly and monthly plans renew automatically until cancelled, and there is no annual commitment. You can cancel at any time in your App Store or Google Play subscription settings.
$1.99per week
$3.99per month
There is no annual or multi-year plan.
The monthly plan may include a 7-day free trial for eligible new subscribers.
See all plansCommon questions
Is WireGuard secure?
Yes, by the measures that matter. It uses modern, well-studied cryptography with no weaker options to fall back to, researchers have analysed its design formally, and its small size makes it practical to review. The protocol only covers the tunnel, though, so how a VPN service runs its servers matters just as much.
Is WireGuard a VPN?
It's the protocol a VPN is built on rather than a service you can sign up for. On its own, WireGuard connects your device to a server you've set up yourself. A VPN service such as WrapVPN runs the servers, puts the keys in place and gives you an app for choosing a location.
Is WireGuard free and open source?
Yes. The protocol is openly documented, and its official implementations are open-source software that anyone can read and use. WireGuard is a registered trademark of Jason A. Donenfeld, which is why you'll often see it written with a small ® symbol.
Why won't WireGuard connect on some networks?
It uses UDP, a kind of internet traffic that most networks carry but some strict ones block, such as guest networks that only allow web browsing. WireGuard has no fallback that disguises itself as ordinary browsing, so on those networks it can't connect. Switching to mobile data is usually the quickest fix.
What does a WireGuard server know about me?
While it's running, it holds each peer's public key and inside address, the network address the latest genuine packet came from, when the last handshake happened and how much data has passed. Anything a server keeps beyond that is up to whoever runs it, which is why a VPN's privacy policy matters more than its protocol.
Do I need to set up WireGuard to use WrapVPN?
No. WrapVPN puts the keys in place and keeps the list of locations for you. Install the app, sign in with Apple or Google, pick a location and tap Connect, and WireGuard does its work underneath.
Download WrapVPN
One account works on your phone, tablet and computer, with no device limit on any plan. Every server location is available on every plan, including the free plan.
Further reading
The following pages cover topics related to this one.
Guide
Is WireGuard secure? What the research says, and what it can't promise
Is WireGuard secure? One fixed set of modern cryptography, formal proofs and very little code, then the honest limits: keys, servers, bugs and visibility.
Guide
WireGuard and privacy: what a WireGuard server remembers about you
A WireGuard server keeps each device's key, inside address, last IP, last handshake and data totals in memory. Why, for how long, and how that differs from logs.
Guide
WireGuard keys explained: private, public and preshared
What WireGuard's private, public and preshared keys are, how wg genkey makes them, why session keys change every two minutes, and what to do if a key leaks.
Guide
WireGuard config files explained, line by line
A WireGuard config file taken apart line by line: PrivateKey, Address, DNS, AllowedIPs, Endpoint and PersistentKeepalive, plus a matching server file.
Guide
WireGuard AllowedIPs explained: one setting, two jobs
What WireGuard's AllowedIPs really does: it picks the peer for every outgoing packet and checks every incoming one. Worked examples for phones, laptops and servers.
Guide
Why WireGuard uses UDP, and what happens when a network blocks it
WireGuard only speaks UDP. Why a tunnel over TCP fights itself, what a blocked handshake looks like, and what to do when a network turns WireGuard away.
Guide
WireGuard and quantum computers: what post-quantum protection means
What a quantum computer would and wouldn't break in WireGuard, why recorded traffic is the real worry, and how the optional preshared key keeps recordings sealed.
Guide
Does WireGuard drain your battery?
Where a VPN's battery cost comes from: the radio, keepalives, network changes and encryption, why WireGuard is light on each, and why battery screens exaggerate.
Guide
Why WrapVPN is built on WireGuard
Our reasons for building on WireGuard: small, reviewable code, modern encryption, quick connections and calm roaming, plus the parts it leaves to us.
Guide
WireGuard vs OpenVPN: what's different for you
WireGuard vs OpenVPN in plain English: connecting, changing networks, speed, battery and maturity, and the situations where OpenVPN is still the better choice.
Guide
WireGuard vs IPsec and IKEv2
IKEv2/IPsec is the VPN built into your phone and laptop. How it compares with WireGuard on simplicity, roaming and setup, and when the built-in one is right.