Xerobit
Dev Productivity

WiFi QR Code Format: Exact WIFI: Payloads, Escaping and Scan Tests

The exact WiFi QR payload for WPA, WEP, open and hidden networks, the escaping rules for special characters, and a decode round trip of generated QR codes.

MA Mian Ali Khalid Updated Nov 17, 2026 6 min read
Free tool
QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, contact cards. Custom size, colors, error correction. Download as PNG or SVG. 100% client-side.
Open tool →
On this page ⌄
  1. The payload format
  2. Payloads by network type
  3. Escaping: the part that breaks passwords
  4. Do real decoders read it back? Round-trip results
  5. Why a Wi-Fi QR code does not work
  6. How phones use the code
  7. Treat the code as the password
  8. FAQ
  9. Tested
  10. Sources

To make a Wi-Fi QR code, open the QR Code Generator, choose "Wi-Fi network", enter the network name, the password and the security type (WPA / WPA2, WEP or none), tick "Hidden network" if the name is not broadcast, and download the PNG or SVG. Everything runs in your browser. The rest of this guide is for when you need to know what is inside the code: a Wi-Fi QR code is ordinary QR text that starts with WIFI:, and getting that one string exactly right is the whole job. Below are the payload for each network type, the escaping rules, what is and is not known about WPA3, and the results of decoding 12 generated codes with independent software.

The payload format

The format is a convention rather than a formal standard: the ZXing project's "Barcode Contents" wiki page proposes it (a MECARD-style record) and labels the section "Android, iOS 11+":

WIFI:T:WPA;S:mynetwork;P:mypass;;
FieldMeaningRule from the ZXing wiki
TAuthentication typeWEP, WPA, WPA2-EAP or nopass. Leaving it out means no password
SSSID (network name)Required
PPasswordIgnored when T is nopass, and may then be left out
HHidden networktrue for a hidden network. A value that is not a boolean is read as the older phase 2 method
E, A, I, PH2EAP method, anonymous identity, identity, phase 2Only for WPA2-EAP (enterprise) networks

Field order does not matter, and the record ends with ;;. There is no WPA2 value in that list: use T:WPA for WPA2 networks, which is also what the generator writes.

Payloads by network type

These strings came out of the site's own module, src/lib/qrWifi.ts, for the inputs shown:

NetworkPayload
WPA / WPA2WIFI:T:WPA;S:HomeNet;P:hunter2pass;;
Open (no password)WIFI:T:nopass;S:Cafe Guest;;
Hidden WPAWIFI:T:WPA;S:HiddenNet;P:secretpass;H:true;;
WEPWIFI:T:WEP;S:OldRouter;P:"1234567890";;

The WEP row shows a rule the generator applies on its own: a value made only of hex digits is wrapped in double quotes ("1234567890"), because the ZXing wiki says to quote an ASCII value that could otherwise be read as hex. That is correct for a passphrase that merely looks like hex, such as a 10-digit number. A genuine WEP hex key (10 or 26 hex digits) is a different case, and how phones treat a quoted one was not tested.

Hidden networks and open networks

H:true; is the whole difference for a hidden network: the phone is told to connect to the name even though the router does not advertise it. An open network uses T:nopass and no P: field, and the generator leaves the password out when "None (open)" is selected, even if the password box still has text in it.

WPA3

The ZXing list of T values has no WPA3 entry, so the generator has no WPA3 option and writes T:WPA for WPA2 and WPA3 alike. A third-party write-up, "Most WPA3 WiFi QR Codes are broken", reports that some platforms write T:SAE, which its author considers outside the specification the article quotes (a value of WPA for password-based networks), and says codes in the WPA3 Transition Disable form carry an extra R: field. That is one author's report, not a Wi-Fi Alliance document, and whether a given phone joins a WPA3-only network from a T:WPA code was not tested. If a WPA3-only network does not join, test the code on a WPA2/WPA3 transition-mode network first to separate a bad payload from a network setting.

Escaping: the part that breaks passwords

The ZXing wiki says \, ;, ,, " and : must each be escaped with a backslash, and gives this example: an SSID that is literally "foo;bar\baz" becomes \"foo\;bar\\baz\". Without escaping, a ; in a password ends the field early and the rest of the password is lost.

Raw valueIn the payload
SSID Cafe;Guest,5GS:Cafe\;Guest\,5G
SSID Lab:5GS:Lab\:5G
SSID "Quoted"S:\"Quoted\"
Password p"a\ss;word,1:xP:p\"a\\ss\;word\,1\:x

The same function in Python, for use outside the tool:

import re
BS = chr(92)  # backslash

def esc(s):
    return re.sub(r'([\\;,:"])', lambda m: BS + m.group(1), s)

def wifi(ssid, pw, t="WPA", hidden=False):
    h = "H:true;" if hidden else ""
    return f"WIFI:T:{t};S:{esc(ssid)};P:{esc(pw)};{h};"

Do real decoders read it back? Round-trip results

Each case below was generated twice: with the site's qrWifi.ts (payload plus its qrInput() helper, described below) and the qrcode 1.5.4 library (error correction M, 4-module margin, 600 px PNG), and with an independent encoder, Python segno 1.6.6. Every image was decoded with zxing-cpp 3.1.1 and with OpenCV 5.0.0 QRCodeDetector, and the decoded text was compared with the payload character by character.

CaseSite code: ZXingSite code: OpenCVsegno code: ZXing and OpenCV
Plain WPAexactexactexact
WEP (key quoted as hex-like)exactexactexact
Open, T:nopassexactexactexact
Hidden, H:trueexactexactexact
SSID with ; and ,exactexactexact
SSID with :exactexactexact
SSID wrapped in quotesexactexactexact
Password with " \ ; , :exactexactexact
SSID and password that look like hexexactexactexact
32-character SSID, 63-character passwordexactexactexact
SSID with a trailing spaceexactexactexact
Non-ASCII SSID Café Wi-Fi ☕, password pässwördexactexactexact

All twelve round-trip in both decoders with the site's current encoder input. The last row used to be the exception, and the history is worth knowing because it can affect any generator built on the same library. Until 2026-11-17 the site passed the payload to the qrcode library as a plain string. For text with non-ASCII characters the library then splits it into an alphanumeric segment (WIFI:T:WPA) plus a byte segment, and OpenCV 5.0.0 returned nothing for such codes while ZXing read them. Across five payloads (plain ASCII, Café, Café Wi-Fi ☕, a Japanese SSID and password, and a hidden network with an emoji) at all four error-correction levels, OpenCV read 4 of 20 codes made that way and ZXing read 20 of 20. The tool now hands the library one byte-mode segment whenever the text contains non-ASCII characters. With that, OpenCV reads 19 of 20 and ZXing 20 of 20. The remaining miss is the longest non-ASCII payload at error correction H, which also failed before. Why OpenCV fails on the mixed-segment version was not investigated: the observation is that it appeared with non-ASCII bytes inside a mixed-segment code and not with ASCII-only payloads that have the same split. Phones were not tested. The practical advice is still to keep SSIDs and passwords to plain ASCII for codes you print, since you cannot control which scanner a guest uses.

Escaping fuzz test

2,000 random SSID and password pairs (SSID 1 to 32 characters, password 8 to 47, drawn from \ ; , : ", letters, digits, a space, an accented letter and an emoji, with random WPA/WEP and hidden flags) were turned into payloads by wifiPayload() and parsed back by a separately written Python reader that follows the wiki's rules. All 2,000 came back unchanged. Building the payload from a 200,000-character SSID and a 200,000-character password took about 30 ms. This shows the escaping and the reader agree with each other and with the wiki's example, not that every phone does.

QR size for the longest realistic code

An SSID is at most 32 bytes and a WPA passphrase at most 63 characters, so the longest realistic payload is 113 characters. The grid size (QR version) that the qrcode library chose for it, next to a typical short payload:

Error correction113-character payloadHomeNet / hunter2pass (36 characters)
L (7%)version 5version 3
M (15%, the tool default)version 6version 3
Q (25%)version 8version 4
H (30%)version 10version 4

segno, which keeps one byte segment, needed versions 6, 7, 9 and 10 for the long payload, so the exact grid size depends on the encoder. For minimum print sizes see the QR code size guide.

Why a Wi-Fi QR code does not work

These are likely causes drawn from the format rules above and the decode results, not a list confirmed on phones.

SymptomLikely cause
Camera reads the code but joining failsWrong password or security type; a ; or : left unescaped; a WPA3-only network (see above)
Phone shows the text instead of offering to joinThe text does not start with WIFI:, or has a space or newline before it
Code not detected at allA scanning problem, not a payload problem: see QR code not scanning
Works for one phone, not anotherNon-ASCII characters, or a scanner app that parses the format differently

How phones use the code

Scanning is done by the phone's camera or a scanner app. Apple's support page "Scan a QR code with your iPhone or iPad" says to open the Camera app, hold the device so the code appears, and tap the link or notification; that page does not mention Wi-Fi, so joining a network from a code rests on the ZXing wiki's note that the format works on Android and iOS 11 and later. For showing a code from a phone that is already connected, Google's Android Help page on Wi-Fi says: open Settings, Network & internet, Internet, choose the network, tap Share, and the device gives you a QR code that a friend scans with another device (the page notes that some steps work only on Android 12 and up). No physical phone was used to test any code in this guide.

Treat the code as the password

The password sits in the code as plain text. Anyone who can photograph it can join, and can read the password back out with any decoder, which is exactly what the tests above do. Put the code on a guest network, change the passphrase when people who knew it leave, and use a strong one from the password generator.

FAQ

How do I get my Wi-Fi QR code? Make one in the QR Code Generator from the network name and password, or, on Android, use Settings, Network & internet, Internet, pick the network and tap Share (Android Help). The generator needs the password typed in; it cannot read it from your router.

How can I generate a Wi-Fi QR code? Choose "Wi-Fi network" in the generator, fill in the three fields, optionally tick "Hidden network", and download the PNG or SVG. The code is built in your browser and the password is not sent anywhere.

How do I scan a QR code for Wi-Fi? Open the phone's camera and point it at the code. Apple documents the Camera-app scan in general terms; Android Help describes scanning a shared code with another device. Tap the prompt to join if one appears.

Which app can show a Wi-Fi QR code? On Android, the Settings app does it: Network & internet, Internet, pick the network, Share (Android Help; some steps need Android 12 or newer). Apple's page cited here covers scanning only, so no iPhone steps for showing a code are given. Samsung and Huawei menus were not checked. For any phone, the QR Code Generator makes a code from the typed credentials.

What is the exact Wi-Fi QR code format? WIFI:T:WPA;S:<ssid>;P:<password>;;, with H:true; for hidden networks and T:nopass for open ones.

Do I write T:WPA2 for a WPA2 network? No. The ZXing list of types is WEP, WPA, WPA2-EAP and nopass; WPA2 personal networks use WPA.

How do I put a semicolon or quote in the password? Put a backslash before each of \, ;, ,, " and :.

Is a Wi-Fi QR code safe to share? It contains the password unencrypted, so share it only where you would share the password.

Tested

2026-11-17. Site module src/lib/qrWifi.ts with qrcode 1.5.4 under Node 25.8 (--experimental-strip-types); independent encoder segno 1.6.6 on Python 3.11; decoders zxing-cpp 3.1.1 and OpenCV 5.0.0 (QRCodeDetector and the Aruco-based detector for the non-ASCII case); 12 payloads decoded and compared exactly (the non-ASCII behaviour was compared before and after qrInput() over 5 payloads at error correction L, M, Q and H, 600 px, 4-module margin: OpenCV 4 of 20 before, 19 of 20 after; ZXing 20 of 20 both); 2,000-pair escaping fuzz with a separate Python reader. Not tested: any physical phone or camera app, iOS or Android joining behaviour, WPA3-only and enterprise (WPA2-EAP) networks, WEP hex keys, Windows.

Sources

Keep reading

Related tools

Written by Mian Ali Khalid. More guides in Dev Productivity.