WireGuard is a modern, open-source VPN protocol designed for speed, simplicity, and security. It uses state-of-the-art cryptography, runs inside the operating system kernel, and sets up a VPN connection by exchanging public keys, much like SSH. Most major VPN apps now offer it as their default protocol.

Photo: KK IN HK, via Wikimedia Commons (CC BY-SA 4.0). WireGuard’s codebase is deliberately tiny: around 4,000 lines, against hundreds of thousands for older protocols.
What Is WireGuard?
WireGuard is a communication protocol and free, open-source software that implements encrypted VPNs. It was created by security researcher Jason A. Donenfeld, who began work on it in 2015 and first released it in 2016. It was merged into the Linux kernel in version 5.6, released in March 2020, and now runs on Windows, macOS, BSD, iOS, and Android.
WireGuard aims to be faster, simpler, leaner, and more useful than IPsec, and considerably more performant than OpenVPN. It is designed as a general purpose VPN for running on embedded interfaces and super computers alike, from smartphones and home routers to fully loaded backbone routers.
The idea behind it is simple: a VPN connection is made by exchanging very simple public keys, exactly like exchanging SSH keys, and all the rest is transparently handled by WireGuard. There is no need to manage connections, worry about state, manage daemons, or handle what is under the hood. Our guide to VPN protocols compares WireGuard with OpenVPN and IPsec, and our guide to VPN encryption explains the ciphers WireGuard uses.
How Does WireGuard Work?
WireGuard works by adding a network interface, like eth0 or wlan0, called wg0. That interface acts as a tunnel interface. You configure it with your private key and your peers’ public keys, and then you send packets across it.
When the interface sends a packet, it looks up which peer the destination address belongs to, encrypts the whole packet using that peer’s public key, and sends the encrypted bytes over the internet to the peer’s most recent endpoint, using UDP. When it receives a packet, it decrypts and authenticates it, checks that the peer is allowed to send packets from that source address, and either accepts it onto the interface or drops it.
The handshake is the Noise IK pattern from the Noise Protocol Framework. It combines long-term and ephemeral Diffie-Hellman values using Curve25519, and it provides perfect forward secrecy, so a compromised key cannot unlock past sessions. Unlike older protocols, there is no separate negotiation phase with dozens of options to agree on. Both sides either have each other’s public keys, in which case they can begin exchanging packets immediately, or they do not, in which case nothing happens.
The model is closer to SSH and Mosh than to IPsec: no username, no password, and no connect button. Both parties hold each other’s public keys, and then they are simply able to begin exchanging packets through the interface.

Photo: Adrian disini, via Wikimedia Commons (CC BY 4.0). WireGuard’s built-in roaming keeps the tunnel alive when a phone switches networks.
Cryptokey Routing
At the heart of WireGuard is a concept called cryptokey routing, which works by associating public keys with a list of tunnel IP addresses that are allowed inside the tunnel. Each network interface has a private key and a list of peers, and each peer has a public key and a list of allowed IPs. Public keys are short and simple, and they can be passed around in configuration files by any out-of-band method, similar to how you might send an SSH public key to a friend.
A small server configuration shows how little there is to it:
[Interface]
PrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=
ListenPort = 51820
[Peer]
PublicKey = xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=
AllowedIPs = 10.192.122.3/32, 10.192.124.1/24
When sending packets, the list of allowed IPs behaves as a routing table: it decides which peer a packet goes to. When receiving packets, it behaves as an access control list: it decides whether a peer is allowed to send packets from a given source address. Because all packets on the interface are encrypted and authenticated, and because identity and allowed address are tightly coupled, administrators do not need complicated firewall extensions, as they do with IPsec. They can simply match on the interface and the source IP and be assured the packet is secure and authentic.

Photo: www.heimnetzwerke.net, via Wikimedia Commons (CC BY 4.0). Cryptokey routing ties each peer’s identity to its allowed addresses, so the firewall rules stay simple.
The Cryptography
WireGuard uses a fixed set of modern cryptographic algorithms, with no options to downgrade or misconfigure. That fixed suite is a deliberate design choice: fewer choices means fewer ways to get the security wrong. The suite is Curve25519 for key exchange, ChaCha20 paired with Poly1305 for encryption and authentication, BLAKE2s for hashing, and HKDF for deriving keys.
It does not use AES. ChaCha20 was chosen because it performs well on hardware without dedicated AES acceleration, including phones and small routers, and because it is more resistant to timing attacks than AES in software.
Because the cryptographic suite is fixed, a WireGuard implementation cannot accidentally negotiate a weak cipher. There is nothing to agree on during the handshake except the keys themselves.
Why Is WireGuard Fast?
WireGuard’s speed comes from three design decisions rather than from any single trick.
First, it lives inside the Linux kernel. Packets are encrypted and decrypted without the context switching that comes from passing them between kernel and user space, which is where OpenVPN spends much of its time. On Windows, WireGuard also runs as a kernel driver.
Second, the codebase is tiny. WireGuard uses only about 4,000 lines of code, against the hundreds of thousands of lines in IPsec and OpenVPN implementations. Fewer lines means fewer bugs, less work for the processor, and a codebase that a single person can audit in full.
Third, the handshake is silent and cheap. WireGuard sends no unencrypted handshake traffic that identifies the protocol, and a peer that receives a packet it cannot authenticate simply drops it without replying. There is no negotiation round trip before data can flow, and the tunnel does not need to be rebuilt when the network changes.

Photo: Solijon Solayev, via Wikimedia Commons (CC BY-SA 4.0). WireGuard runs well on small hardware such as home routers, which is why it is the default on many of them.
WireGuard vs OpenVPN
The comparison readers ask about most is WireGuard against OpenVPN, and the honest answer is that each wins on different ground.
| WireGuard | OpenVPN | |
|---|---|---|
| Code size | Around 4,000 lines | Hundreds of thousands of lines |
| Cryptography | Fixed modern suite: ChaCha20-Poly1305, Curve25519 | Configurable: AES, ChaCha20, many options |
| Transport | UDP only | UDP or TCP |
| Where it runs | In the kernel | In user space (DCO offloads the data channel since 2.6) |
| Key management | Public keys only; distribution is out of scope | Certificates, passwords, pre-shared keys, plugins |
| Roaming | Built in | Reconnects on network change |
| Firewall traversal | Can struggle where UDP is blocked | TCP mode on port 443 passes most firewalls |
WireGuard is the better pick for speed, battery life, and simplicity, especially on mobile devices and routers. OpenVPN is the better pick where flexibility matters: where TCP is needed to pass a restrictive firewall, where certificates and central user management are required, or where an older system does not support WireGuard yet.
For most people the choice is made by the VPN app, which usually defaults to WireGuard and offers OpenVPN as the fallback. That default is sensible. Our guide to OpenVPN covers the older protocol in full, including its version history and DCO support.
The Limitations
WireGuard’s simplicity comes with real trade-offs, and they are worth knowing before choosing it.
No key distribution. WireGuard deliberately leaves key distribution out of scope. There is no built-in way to hand out keys, revoke a user, or push configurations to clients. VPN providers and system administrators build that layer themselves, which is why provider implementations of WireGuard differ in how they handle privacy.
Static addresses per peer. Each peer is assigned tunnel IP addresses, and those addresses stay the same for as long as the configuration does. A provider that assigns the same tunnel address to a user on every connection makes that user easier to recognise than one that rotates addresses or hides users behind shared addresses with network address translation. Providers handle this differently: NordVPN’s NordLynx, for example, uses double NAT so that a user’s real address and tunnel address are not linked in the provider’s records.
UDP only. WireGuard passes traffic over UDP and has no TCP mode. Networks that block UDP entirely will block WireGuard, where OpenVPN over TCP would still connect. There is no built-in obfuscation either, so on networks that actively identify and block VPN traffic, WireGuard is easier to spot than OpenVPN with obfuscation.
No built-in kill switch or extras. WireGuard is only a tunnel. Features such as a kill switch, split tunneling, and DNS leak protection come from the app or the operating system around it, not from WireGuard itself. Our guide to the VPN kill switch explains the feature that guards the tunnel when it drops.
How to Use WireGuard
There are three ways most readers will meet WireGuard.
In a VPN app. This is the common route. Open the app’s protocol settings, pick WireGuard, and connect. The app handles key generation, server selection, and key rotation for you. Most major apps now default to WireGuard or to their own variant of it, such as NordLynx.
As a self-hosted VPN. WireGuard is well suited to running your own VPN server, because the configuration is a few lines long. Install WireGuard on a server, generate a key pair with wg genkey, add a peer block for each device, and connect from the WireGuard app by scanning a QR code or importing a configuration file. Our guide to self-hosted VPN covers the wider setup.
On a router. Many modern routers support WireGuard natively, which protects every device on the home network at once. The router holds one tunnel to the VPN provider, and all traffic from the house goes through it.
A WireGuard client configuration looks like this:
[Interface]
PrivateKey = gI6EdUSYvn8ugXOt8QQD6Yc+JyiZxIhp3GInSWRfWGE=
ListenPort = 21841
[Peer]
PublicKey = HIgo9xNzJMWLKASShiTqIybxZ0U3wGLiUeJ1PKf8ykw=
Endpoint = 192.95.5.69:51820
AllowedIPs = 0.0.0.0/0
The private key never leaves the device. The public key is shared with the server. AllowedIPs of 0.0.0.0/0 means all traffic goes through the tunnel. The default UDP port is 51820, although servers can listen on any port.

Photo: Solijon Solayev, via Wikimedia Commons (CC BY-SA 4.0). A WireGuard setup is a few lines of configuration: keys, an endpoint, and the addresses allowed through the tunnel.
WireGuard in VPN Apps
WireGuard is free, so there is no such thing as a WireGuard subscription to buy. What you pay for is a VPN service that uses WireGuard as its protocol. Providers that support WireGuard include NordVPN, Surfshark, Mullvad, Proton VPN, and Private Internet Access, among others.
Because WireGuard itself does not handle key distribution or user management, each provider wraps it differently. Some assign a fresh key pair per session, some rotate tunnel addresses, and some add their own privacy layers such as double NAT. Those differences matter more than the protocol itself: two providers both offering WireGuard can still differ a great deal in what they log and how they link addresses to accounts.
Related Guides
- VPN protocols compared: WireGuard against OpenVPN and IPsec.
- Types of VPN and VPN technologies: the full overview of VPN types.
- How does a VPN work: the tunnel WireGuard creates.
- OpenVPN explained: the older, more configurable alternative.
- Dedicated and static IP VPN: a fixed address on your VPN connection.
- L2TP and PPTP explained: older protocols WireGuard replaced.
- SSL VPN explained: the TLS-based business alternative.
Watch: How to Set Up WireGuard VPN on a VPS
How to Set Up WireGuard VPN on a VPS (Step-by-Step for Beginners), by kongwenbin on YouTube (about 14 minutes). It walks through creating a server, generating keys, configuring server and client, and connecting a phone by QR code.

Photo: Jugendpresse Deutschland, via Wikimedia Commons (CC BY 2.0). WireGuard’s speed shows most on fast connections, where older protocols become the bottleneck.
FAQs
What is WireGuard VPN?
WireGuard is a modern, open-source VPN protocol that creates encrypted tunnels using public keys, much like SSH. It runs inside the operating system kernel, uses a fixed set of modern ciphers, and is known for speed, simplicity, and a codebase of only around 4,000 lines.
Is WireGuard safe?
Yes. WireGuard uses state-of-the-art cryptography, including Curve25519 for key exchange and ChaCha20-Poly1305 for encryption, with perfect forward secrecy. Its small codebase has been formally verified and audited. Safety also depends on the provider’s implementation, particularly how it handles key rotation and logging.
Is WireGuard better than OpenVPN?
For speed, battery life, and simplicity, yes. For flexibility, no: OpenVPN offers TCP mode for restrictive networks, certificates and central user management, and two decades of deployment history. Most VPN apps default to WireGuard and offer OpenVPN as the fallback.
Is WireGuard free?
Yes. WireGuard is free and open-source software. There is no WireGuard subscription to buy. You pay for a VPN service that uses WireGuard, or you run your own WireGuard server, which costs only the price of the server itself.
What port does WireGuard use?
WireGuard uses UDP port 51820 by default, although a server can be configured to listen on any UDP port. It runs only over UDP and has no TCP mode, so it can be blocked on networks that allow only TCP traffic.
Does WireGuard work on mobile?
Yes. WireGuard runs on Android and iOS, and its built-in roaming keeps the tunnel up when the device switches between Wi-Fi and mobile data, instead of dropping and reconnecting.
Sources
7
- WireGuard. “WireGuard: fast, modern, secure VPN tunnel.” https://www.wireguard.com/
- Donenfeld, Jason A. “WireGuard: Next Generation Kernel Network Tunnel.” https://www.wireguard.com/papers/wireguard.pdf
- Wikipedia. “WireGuard.” https://en.wikipedia.org/wiki/WireGuard
- TechRadar. “What is WireGuard?” https://www.techradar.com/vpn/what-is-wireguard
- All About Cookies. “What Is WireGuard? (And Why Your VPN Experience Isn’t the Same Without It).” https://allaboutcookies.org/wireguard-vpn-protocol
- Surfshark. “WireGuard VPN: what is it and why use it?” https://surfshark.com/blog/what-is-wireguard
- Nym. “What is WireGuard VPN & how does it work?” https://nym.com/blog/what-is-wireguard-vpn
Every factual claim on this page was verified against a named source above.



