WireGuard key generator

Private key, public key and complete configuration of a WireGuard peer, ready to import into the client.

Settings
Peer configuration (wg0.conf)

Send with onlyU — Your recipient gets a link they can open only once, then the link is gone. onlyU opens in a new tab with the secret already filled in: all you have to do is create the link. Free, no sign-up. How does it work?

To add on the server

This [Peer] section goes into the server configuration. It contains no private key.

QR code for the mobile app

The WireGuard app for Android and iOS imports the configuration by scanning this QR code. It contains the private key: show it only to its recipient.

Computed in your browser. Nothing is sent unless you choose onlyU.

A peer's keys and configuration, in one click

Adding a user to a WireGuard VPN takes three things: a key pair for their device, an entry for that key on the server, and a configuration file to import into their client. The generator creates the keys with your browser's Web Crypto API, on the X25519 curve, exactly like wg genkey and wg pubkey: 32 bytes encoded in Base64. It then fills in the peer's wg0.conf file with the settings you provide.

Everything is computed in the page, which is not allowed to make network requests. X25519 in Web Crypto requires a recent browser: if yours does not offer it, the page tells you instead of failing silently.

The peer's file

[Interface]
PrivateKey = <peer private key>
Address = 10.0.0.2/32
DNS = 10.0.0.1

[Peer]
PublicKey = <server public key>
PresharedKey = <pre-shared key, optional>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.0.0.0/24
PersistentKeepalive = 25
  • Address: the peer's address inside the tunnel, unique to each user.
  • DNS: the name server to use once connected. This line is applied by wg-quick and by the official WireGuard apps; on Linux, wg-quick relies on resolvconf for this.
  • PublicKey: the server's public key (not the peer's), shown on the server by wg show.
  • Endpoint: the server's public address and UDP port.
  • AllowedIPs: what goes through the tunnel. 0.0.0.0/0, ::/0 routes all traffic through it; a specific network, such as 10.0.0.0/24, limits the VPN to internal resources.
  • PersistentKeepalive: a signal every 25 seconds that keeps the tunnel open when the peer is behind a router or firewall doing address translation (NAT).

The pre-shared key

Optional, the pre-shared key (the equivalent of wg genpsk) adds a layer of symmetric encryption between this peer and the server. It protects traffic recorded today against a future quantum computer able to break X25519. If you enable it, the same value must be set on both sides.

Declare the peer on the server

The server only needs the peer's public key, never its private key. Add a section to its configuration:

[Peer]
PublicKey = <peer public key>
PresharedKey = <same pre-shared key>
AllowedIPs = 10.0.0.2/32

On the server side, AllowedIPs is the address assigned to the peer. The generated file, for its part, is imported into the client: on Linux with wg-quick up, and in the Windows, macOS, Android and iOS apps by importing a tunnel file.

Hand the configuration to the user

The safest approach is for each user to generate their key pair on their own device and share only their public key. When the administrator prepares the full configuration, the file contains the peer's private key: it opens the VPN to whoever holds it.

“Send with onlyU” sends the entire configuration file. onlyU encrypts it in your browser and creates a link the user can open only once, valid for 24 hours, after which the link disappears. For a line-by-line explanation, read our guide on how to configure a WireGuard peer.

Frequently asked questions

How are the WireGuard keys generated?

By your browser's Web Crypto API, on the X25519 curve, exactly like wg genkey and wg pubkey: 32 bytes encoded in Base64.

What is the pre-shared key for?

It is an extra layer of symmetric encryption between two peers. It is optional, but recommended for long-term protection, including against future quantum computers.

What should I put in AllowedIPs?

The addresses whose traffic goes through the tunnel: 0.0.0.0/0, ::/0 to send everything through the VPN, or only the company network (for example 10.0.0.0/24) for targeted access.

What do I do with the generated public key?

Add it to the server in a [Peer] section, with the address assigned to the peer (AllowedIPs). The generated file is imported into the new user's WireGuard client.

How do I send the configuration to the user?

The file contains their private key, so keep it out of email. “Send with onlyU” hands it to them through a link that opens only once.