DevTools Logo

WireGuard Config Generator

WireGuard Config Generator

Generate wg-quick client and server configs with real X25519 keys. Nothing is uploaded or stored.

Runs in your browser
Try an example

Client interface

Private key is required. Generate one or paste an existing key.

Address is required, for example 10.0.0.2/24.

Server peer

Peer public key is required.

AllowedIPs is required, for example 10.0.0.0/24.

wg0.conf

Generate a key pair to start

Or load an example. Keys are created in your browser with the Web Crypto random source.

Examples

Interface with two peers

Input
generateWireGuardConfig({ interface: { privateKey: key, address: ["10.0.0.1/24"] }, peers: [{ publicKey: key, allowedIPs: ["0.0.0.0/0"], persistentKeepalive: 25 }, { publicKey: key, allowedIPs: ["10.10.0.0/16"] }] })
Output
[Interface] + two [Peer] blocks, PersistentKeepalive = 25 on the first

Peers render in input order with per-peer AllowedIPs and keepalive lines where set.

Optional DNS and MTU

Input
generateWireGuardConfig({ interface: { privateKey: key, address: ["10.0.0.1/24"], dns: ["1.1.1.1"], mtu: 1420 }, peers: [] })
Output
DNS = 1.1.1.1 + MTU = 1420 under [Interface]

DNS and MTU lines appear only when provided; omitting them leaves a minimal interface block.

About this tool

WireGuard Config Generator validates and renders wg-quick style configs with generateWireGuardConfig(config): the [Interface] section emits the trimmed PrivateKey, one Address line per CIDR, and optional DNS, MTU, and ListenPort lines only when set, followed by one [Peer] block per peer in input order with its PublicKey, AllowedIPs, and optional PresharedKey, Endpoint, and PersistentKeepalive.

Validation is explicit via validateWireGuardConfig and the isValidCIDR/isValidWireGuardKey helpers: keys must match 44-character base64 decoding to exactly 32 bytes, CIDRs must be well-formed IPv4 (/0–/32 with octets 0–255) or IPv6 (/0–/128, at most one ::), and PersistentKeepalive must be an integer 0–65535. Each failure returns a field-tagged issue such as peers.0.allowedIPs.0.

An optional generateWireGuardKeyPair derives an X25519 pair via WebCrypto and returns base64 keys, or null where unsupported. Generation is deterministic string building in the browser — keys and endpoints never leave the device.

How to use this tool

  1. Enter interface keys and addresses

    Provide a 44-character base64 private key and one CIDR per Address line (e.g. 10.0.0.1/24).

  2. Add peers in order

    Add each peer's public key and AllowedIPs, plus optional endpoint, preshared key, and keepalive — blocks render in the order listed.

  3. Set DNS and MTU only if needed

    Leave dns and mtu blank to omit those lines; set them to emit DNS = and MTU = entries.

  4. Validate and copy the config

    Check the field-tagged issues list, then paste the output into wg0.conf and bring it up with wg-quick.

Use cases

Scaffolding road-warrior configs

Render client configs with 0.0.0.0/0 peers, endpoints, and keepalives for NAT traversal.

Linting pasted keys and CIDRs

Catch malformed base64 keys and out-of-range prefixes via field-tagged issues before deploying.

Generating site-to-site peers

List multiple peers with per-site AllowedIPs in a fixed order for repeatable configs.

Common mistakes

Mistake:Using a key that looks right but is not 44-char base64.

Fix:Keys must match /^[A-Za-z0-9+/]{43}=$/ and decode to 32 bytes — short strings and URL-safe alphabets fail isValidWireGuardKey.

Mistake:Writing an IPv4 prefix above /32.

Fix:10.0.0.0/44 is rejected — IPv4 prefixes clamp to 0–32 and IPv6 to 0–128, with at most one :: in v6 addresses.

Mistake:Expecting DNS/MTU/keepalive lines to always appear.

Fix:DNS, MTU, and PersistentKeepalive emit only when set — an unset keepalive (undefined) leaves no line, and 0 validates as in-range.

Frequently asked questions

What does this tool do?

It validates and renders wg-quick configs with generateWireGuardConfig: an [Interface] block (PrivateKey, Address lines, optional DNS/MTU/ListenPort) plus one [Peer] block per peer in input order, with validateWireGuardConfig reporting field-tagged issues.

What key and CIDR rules apply?

Keys must be 44-character base64 decoding to exactly 32 bytes; IPv4 CIDRs need octets 0–255 with prefix 0–32, IPv6 needs prefix 0–128 with at most one ::. PersistentKeepalive must be an integer 0–65535.

Is my key material uploaded or stored?

No. Validation, rendering, and optional X25519 key-pair generation via WebCrypto all run in your browser — keys and endpoints never leave your device.

When do DNS, MTU, and keepalive lines appear?

Only when set: blank DNS/MTU are omitted, and an unset (undefined) PersistentKeepalive leaves no line. A keepalive of 0 is valid and in-range.

References & standards