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.
On this page ⌄
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;;
| Field | Meaning | Rule from the ZXing wiki |
|---|---|---|
T | Authentication type | WEP, WPA, WPA2-EAP or nopass. Leaving it out means no password |
S | SSID (network name) | Required |
P | Password | Ignored when T is nopass, and may then be left out |
H | Hidden network | true for a hidden network. A value that is not a boolean is read as the older phase 2 method |
E, A, I, PH2 | EAP method, anonymous identity, identity, phase 2 | Only 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:
| Network | Payload |
|---|---|
| WPA / WPA2 | WIFI:T:WPA;S:HomeNet;P:hunter2pass;; |
| Open (no password) | WIFI:T:nopass;S:Cafe Guest;; |
| Hidden WPA | WIFI:T:WPA;S:HiddenNet;P:secretpass;H:true;; |
| WEP | WIFI: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 value | In the payload |
|---|---|
SSID Cafe;Guest,5G | S:Cafe\;Guest\,5G |
SSID Lab:5G | S:Lab\:5G |
SSID "Quoted" | S:\"Quoted\" |
Password p"a\ss;word,1:x | P: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.
| Case | Site code: ZXing | Site code: OpenCV | segno code: ZXing and OpenCV |
|---|---|---|---|
| Plain WPA | exact | exact | exact |
| WEP (key quoted as hex-like) | exact | exact | exact |
Open, T:nopass | exact | exact | exact |
Hidden, H:true | exact | exact | exact |
SSID with ; and , | exact | exact | exact |
SSID with : | exact | exact | exact |
| SSID wrapped in quotes | exact | exact | exact |
Password with " \ ; , : | exact | exact | exact |
| SSID and password that look like hex | exact | exact | exact |
| 32-character SSID, 63-character password | exact | exact | exact |
| SSID with a trailing space | exact | exact | exact |
Non-ASCII SSID Café Wi-Fi ☕, password pässwörd | exact | exact | exact |
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 correction | 113-character payload | HomeNet / hunter2pass (36 characters) |
|---|---|---|
| L (7%) | version 5 | version 3 |
| M (15%, the tool default) | version 6 | version 3 |
| Q (25%) | version 8 | version 4 |
| H (30%) | version 10 | version 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.
| Symptom | Likely cause |
|---|---|
| Camera reads the code but joining fails | Wrong password or security type; a ; or : left unescaped; a WPA3-only network (see above) |
| Phone shows the text instead of offering to join | The text does not start with WIFI:, or has a space or newline before it |
| Code not detected at all | A scanning problem, not a payload problem: see QR code not scanning |
| Works for one phone, not another | Non-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
- ZXing project wiki, "Barcode Contents", Wi-Fi network config section: fields, types, escaping, hex quoting.
- Google, "Connect to Wi-Fi networks on your Android device", Android Help: sharing a network as a QR code.
- Apple, "Scan a QR code with your iPhone or iPad": Camera-app scanning steps.
- stevetech-me, "Most WPA3 WiFi QR Codes are broken": third-party report on
T:SAEand the WPA3 form; one author's analysis.
Keep reading
QR Code Not Scanning? Causes, Fixes and Measured Limits
QR code not scanning? A symptom table plus measured limits for contrast, quiet zone, logo size per error correction level, blur, tilt, curvature and URL length.
QR Code Minimum Size: Measured Pixels, Centimetres by Distance and PNG vs JPG
QR code minimum size from decoder tests: pixels per module for versions 1 to 10, centimetres by scan distance, DPI for print, business card size and PNG vs JPG vs SVG.
Related tools
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.
Hours Calculator
Add start, end and break times for each day to see daily hours, weekly totals and overtime instantly.
Character Counter
Count characters, words, sentences, lines and UTF-8 bytes with live SEO and social media limit tracking.
Keyboard Test
Press any key to see it light up and find dead, stuck or double-typing keys, with rollover checks for full size, TKL and 75% layouts.
Written by Mian Ali Khalid. More guides in Dev Productivity.