SS Safe Surf Lab
vpnwireguardqr code

VPN QR Code: How to Scan, Create and Protect a WireGuard Config

What a VPN QR code is, how to scan one into the WireGuard app, how to make one from a router or a .conf file, and why you should treat it like a password.

SS Safe Surf Lab team · · 6 min read · 7 sources
Churchill Club Top 10 Tech Tech Trends Debate 2013 — I chose Deep Learning / Machine Learning
Photo: jurvetson (CC BY 2.0) via Openverse

A “VPN QR code” is almost always a WireGuard client configuration packed into a QR image, so you can set up a phone by scanning it instead of typing keys and IP addresses. You open the official WireGuard app, tap +, choose Create from QR code (some guides call it “Scan from QR code”; wording varies by platform and version), point the camera at the code, name the tunnel, and switch it on.

The rest of this guide covers where these codes come from, how to make one yourself, what can go wrong, and the one security point most people miss: the code usually contains your private key.

What’s actually inside a VPN QR code

WireGuard connections are defined by a short text file (a .conf file) with an [Interface] section for your device and a [Peer] section for the server. A QR code is just that text, encoded as an image. Nothing magic happens when you scan it; the app reads the text and saves it as a tunnel.

That means two practical things:

  • The QR code is the config. If the config is wrong, the code is wrong. Regenerating the image won’t fix a bad file.
  • It usually includes a secret. A client config contains the client’s private key. One OpenWrt forum thread argues the key should ideally never leave the device, but in practice most router firmware and server tools put the full client config, private key included, in the code. Treat it like a password.

QR import is mainly a WireGuard feature. You’ll rarely see it for OpenVPN or IKEv2 setups.

Where you’ll find a VPN QR code

SourceHow you get the codeNotes
Consumer router with a WireGuard server (e.g. TP-Link Archer)Shown in the router’s VPN server page after you enable WireGuardTP-Link says the router generates both a config file and a QR code
OpenWrt (LuCI)Under the peer’s configuration in the WireGuard interface settingsThe code moved from the status page to the peer config in newer LuCI versions
Self-hosted panels such as wg-easyQR option next to each client in the web UIwg-easy lists per-client QR codes as a core feature
Your own Linux serverYou create it with qrencodeSee the steps below
Commercial VPN providerOften not offeredProton VPN and Mullvad document downloading a .conf file instead

As of November 2026, router menus and panel layouts change between firmware versions, so the exact menu names on your device may differ from these guides.

How to scan a VPN QR code on your phone

These steps use the official WireGuard app on Android or iOS, following TP-Link’s client setup guide.

  1. Install the official WireGuard app from Google Play or the App Store.
  2. Open the app and tap the + button.
  3. Choose Create from QR code. Allow camera access if asked.
  4. Point the camera at the QR code on your router page, panel or terminal.
  5. Give the tunnel a name you’ll recognise (for example “Home router”).
  6. On iOS, approve the prompt to add a VPN configuration.
  7. Toggle the tunnel on.

To check it’s working, open the tunnel’s details. TP-Link’s guide says that if you see a latest handshake time and data transfer counters going up, the connection is established. If “latest handshake” stays empty, the phone never reached the server; a blocked UDP port or a wrong endpoint address is the usual suspect.

If you’d rather not use the camera, the same menu offers Create from file or archive, which imports a .conf file you’ve saved to the phone.

How to create a VPN QR code yourself

If you run your own WireGuard server on Linux, the standard tool is qrencode. The FreedomBox manual on the Debian wiki notes that the mobile client supports QR input and that qrencode can draw the code right in the terminal.

  1. Create or locate the client config (not the server’s own config). It should have the client’s private key and address under [Interface], and the server’s public key, endpoint and allowed IPs under [Peer].

  2. Install qrencode from your distribution’s package manager (on Debian and Ubuntu the package is qrencode).

  3. Print the code in the terminal:

    qrencode -t ansiutf8 < client.conf
    
  4. Or save it as an image if you need to show it on another screen:

    qrencode -t png -o client-qr.png < client.conf
    
  5. Scan it with the phone as described above.

  6. Delete the PNG, and clear your terminal scrollback, once the phone is set up.

Two details trip people up. First, feed qrencode the contents of the file (with < or the -r option). Passing just the file name encodes the literal text “client.conf”, which the app will reject. Second, the file may be readable only by root (for example under /etc/wireguard/), so you may need sudo to read it.

What about browser-based QR tools?

There are websites that turn pasted WireGuard config text into a QR code, and some say processing stays in your browser. Those claims are self-reported and hard to verify. Since you’d be pasting a private key into a web page, generating the code locally with qrencode, your router or your own panel is the safer choice.

Troubleshooting a QR code that won’t import

“Not a valid WireGuard configuration” or “Unknown attribute.” The encoded text isn’t a clean client config. People report this when the file includes server-side lines such as SaveConfig, or when they encoded the file name instead of its contents. Rebuild the code from a plain client .conf.

The camera won’t lock on. The wg-easy documentation suggests better lighting, adjusting the distance and cleaning the lens. Making the terminal window larger or using the PNG output also helps, because dense codes with long keys need decent resolution.

The code was made for a different app. Configs that use AmneziaWG’s extra obfuscation parameters can’t be read by the standard WireGuard app, according to wg-easy’s docs; they need the AmneziaWG client.

The tunnel imports but nothing loads. That’s a network problem, not a QR problem. Check that the server’s WireGuard UDP port is forwarded and open, that the endpoint address in the config is your public IP or hostname, and that DNS is set in the config.

The router’s keys were regenerated. If you reset or regenerate the server keys, every client needs a fresh config. TP-Link’s Omada documentation warns about this explicitly, so scan the new code on each device.

Keeping your VPN QR code safe

Because the code normally carries the client private key, anyone who scans it, photographs your screen, or finds the image in a chat history can connect as that device. A few habits help:

  • One code per device. Create a separate client (peer) for each phone or tablet. If one is lost, you remove that peer without touching the others.
  • Don’t send it by email or messaging apps unless there’s no alternative. Show it on screen and scan it in person where you can.
  • Delete saved images and screenshots after setup.
  • Revoke lost devices by deleting their peer on the router or server.
  • Check what your firmware puts in the code. The OpenWrt thread above came from a user surprised by what the QR code contained. Look before you share.

The short version

A VPN QR code is a WireGuard config in image form. Scan it with the official WireGuard app via + > Create from QR code, confirm you get a handshake, and treat the code like a password. If you run your own server, qrencode -t ansiutf8 < client.conf is the standard way to make one. If you use a commercial VPN, its own app is usually simpler, and many providers offer a .conf download rather than a QR code.

Frequently asked questions

Is it safe to share a VPN QR code? +

Only with the one person and device it was made for. A WireGuard client QR code normally holds the full client config, including its private key, so anyone who scans it can use that tunnel. Don't email it or post it, and delete saved images once the device is set up.

Why does the WireGuard app say my QR code is not a valid configuration? +

Usually the encoded text isn't a clean client config. Common causes are encoding the file name instead of the file contents, including server-only lines such as SaveConfig, or using a config made for a different app such as AmneziaWG. Regenerate the code from the client .conf file and try again.

Can I scan a VPN QR code on a laptop? +

QR import is a mobile-app feature. On a computer, the usual route is to import the same .conf file directly into the WireGuard client, which is what most router and VPN provider guides describe.

Do commercial VPN providers give out QR codes? +

Some do, but many don't. Proton VPN and Mullvad, for example, document downloading a WireGuard .conf file rather than scanning a QR code. Their own apps are generally the easier option anyway; QR codes matter most for self-hosted and router-based VPNs.

Sources

  1. How to set up WireGuard VPN Client on Android and iOS (TP-Link) (tp-link.com)
  2. VPN - Configuration Guide for Archer Routers (TP-Link Community) (community.tp-link.com)
  3. FreedomBox Manual: WireGuard (Debian Wiki) (wiki.debian.org)
  4. wg-easy (GitHub) (github.com)
  5. WireGuard on iOS (Mullvad) (mullvad.net)
  6. Wireguard setup: no QR code in wireguard status (OpenWrt Forum) (forum.openwrt.org)
  7. luci-app-wireguard QR Code shows Private Key (OpenWrt Forum) (forum.openwrt.org)
About this guide. Researched and drafted with AI assistance from the sources above, then checked against our editorial rules. It reflects what was publicly known on November 10, 2026; details can change, so confirm with the official source before acting on it. How we work →

Our reviews

In-depth reviews from Safe Surf Lab that go with this topic.

Keep reading