↑↓ to move ↵ to open Esc to close Browse all tools

Security guide

Wi-Fi QR Code Format: The WIFI: String Explained

A Wi-Fi QR code is nothing more than a short text string in a known layout. The phone reads the string, sees that it starts with WIFI:, and offers to join the network named in it. Here is the layout field by field, the escaping rule that trips up passwords with semicolons or colons, four worked examples, how Android and iOS handle the scan, and what to think about before you print the code.

The string

The format comes from the ZXing barcode project, whose wiki documents it as the Wi-Fi network config type. Its example is:

WIFI:T:WPA;S:mynetwork;P:mypass;;

Each field is a letter, a colon, a value and a semicolon. The string ends with a second semicolon after the last field. The order of the fields does not matter, so WIFI:S:mynetwork;T:WPA;P:mypass;; means the same thing. There is no checksum and no encryption: the code is just this text, encoded as a QR code like any other.

The fields

FieldMeaningValues
TAuthentication typeWEP, WPA, WPA2-EAP, nopass; may be omitted for no password
SNetwork name (SSID)Required; wrap in double quotes if the name could be read as hex
PPasswordIgnored when T is nopass, and may be omitted then
HHidden networktrue if the SSID is not broadcast; otherwise leave it out
E, A, I, PH2Enterprise settingsWPA2-EAP only: EAP method, anonymous identity, identity, phase 2 method

Only S is strictly required. For an open network write T:nopass and leave P out, or omit T entirely. The four enterprise fields exist for networks that authenticate with a username and an EAP method; a home or small office network never needs them. The ZXing page notes that early versions of its scanner app misused H for the phase 2 method, which is why a non-boolean value in H is still read that way; for your codes, H is either true or absent.

WPA2, WPA3 and the T field

The ZXing specification lists four values for T: WEP, WPA, WPA2-EAP and nopass. There is no WPA2 or WPA3 value. For a personal network protected by WPA2 or WPA3, write T:WPA. It is the only value the specification offers for a personal network, so it is what the generators and scanner libraries built on ZXing accept. WEP is listed for old networks only; the guide to WPA2 vs WPA3 explains why a router should not be running it. The Wi-Fi Alliance also has a QR-based standard called Wi-Fi Easy Connect, which provisions devices by scanning a QR code or NFC tag using public key cryptography. That is a different mechanism with a different payload; the WIFI: string on this page is the one that printable password cards and phone share screens use.

Escaping

Five characters have a job inside the string, so a network name or password that contains them has to be escaped with a backslash. The ZXing page lists them as backslash, semicolon, comma, double quote and colon, the same rule the MECARD contact format uses.

CharacterWritten as
\\\
;\;
,\,
"\"
:\:

The page's own example is a network literally named "foo;bar\baz", double quotes included, which encodes as:

WIFI:S:\"foo\;bar\\baz\";;

Two more rules from the same page. If the network name or password consists only of hex digits, such as ABCD1234, wrap it in double quotes so a scanner does not treat it as a hex-encoded value. Spaces, hyphens, underscores, periods and most other punctuation need no escaping.

Worked examples

Each string below was built by the escaping rule above from the name and password shown.

CaseName / passwordString
Plain home networkHartmann Home / blue-kettle-4821WIFI:T:WPA;S:Hartmann Home;P:blue-kettle-4821;;
Password with a semicolon and a colonShop5G / open;at:9WIFI:T:WPA;S:Shop5G;P:open\;at\:9;;
Name with a comma, hidden networkSmith, Guest / Guest2026WIFI:T:WPA;S:Smith\, Guest;P:Guest2026;H:true;;
Open network, no passwordLibrary LobbyWIFI:T:nopass;S:Library Lobby;;

In the second row the password open;at:9 becomes open\;at\:9; without the backslashes a scanner would end the password at the first semicolon. In the third row the comma in the name is escaped and H:true is added because the router does not broadcast the name. In the fourth row there is no P field at all.

To make the code, paste the finished string into the QR code generator as plain text, then point the QR code scanner at the result. It should display the exact string, backslashes included; if a field looks truncated, an escape is missing. The Wi-Fi password card template builds the string from the name and password and prints it with the code.

How phones read it

On Android, Google's help page describes the share side: open Settings, go to Network & internet, then Internet, pick your network and tap Share, and the phone shows a QR code; to join the same network, a friend scans that code with another device. Google notes that some of the steps work only on Android 12 and up. On iPhone, Apple's support page says to open the Camera app from the Home Screen, Lock Screen or Control Center, hold the device so the QR code appears, and tap the link that appears. Apple's page covers QR codes in general and does not single out Wi-Fi codes, so test your printed card with the phones your guests actually bring before relying on it.

Privacy: the password is in the picture

Because the string is plain text, anyone who scans the code has the password in readable form, and a photo of the card is as good as the card. Three habits keep that manageable:

  • If your router offers a guest network, print the card for that one, not for the network your computers and printers sit on.
  • Use a long password anyway. The password generator can make one from words, which stays easy to type for guests whose phone fails to scan.
  • When the card is lost or a tenant moves out, change the password and print a new card. The old code keeps working until you do.

A hidden network (H:true) is not a privacy measure for the code itself; the name and password are still in the string.

Printing the code

A WIFI: string with a 32-character name and a 20-character password is 70 characters long, counting the field letters and separators. More characters mean a higher QR version with more modules, and the print has to grow with it; the guide to QR code size for print gives the module counts per version and the minimum sizes by scan distance. Leave the quiet zone around the code clear and print it dark on a light background.

Frequently asked questions

What is the format of a Wi-Fi QR code?

A plain text string that starts with WIFI: and lists fields separated by semicolons, ending in two semicolons. The ZXing project, whose wiki documents the format, gives the example WIFI:T:WPA;S:mynetwork;P:mypass;; where T is the security type, S the network name and P the password.

Which T value do I use for a WPA2 or WPA3 network?

The ZXing specification lists WEP, WPA, WPA2-EAP and nopass as the values for T; it has no separate WPA2 or WPA3 value. Use T:WPA for a personal network protected by WPA2 or WPA3; it is the only personal value the specification offers, and it is what generators and scanners built on it accept. WPA2-EAP is only for enterprise networks that log in with a username.

Which characters have to be escaped?

Backslash, semicolon, comma, double quote and colon. Put a backslash in front of each one, so a password like a;b becomes a\;b. Everything else, including spaces and most symbols, is written as is. A network name made only of hex digits should be wrapped in double quotes so it is not read as a hex value.

Is a Wi-Fi QR code safe to print?

The password is stored in the code as readable text. Anyone who scans it, or photographs it and scans it later, has the password. Print it only for networks you would hand the password to anyway, such as a guest network, and change the password if the card goes missing.

Can I make the code without an app?

Yes. Write the WIFI: string by hand following the escaping rules, paste it into any QR code generator as plain text, and test it with a scanner before printing. The scanner should show the exact string you typed.

Sources