On this page
What is inside a 2FA QR code
The QR code a website shows when you turn on two-factor authentication is just text: an otpauth URI that tells your authenticator app the secret key and how to use it. A typical one looks like this:
otpauth://totp/Example:alice@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example&algorithm=SHA1&digits=6&period=30
The format comes from the "Key Uri Format" that Google published for Google Authenticator, and practically every authenticator app reads it. You can decode any 2FA QR code into this text with our QR code to secret key tool, or build one from a key with the 2FA QR code generator.
The parts of the URI
The general shape is otpauth://TYPE/LABEL?PARAMETERS.
| Part | Required? | Meaning |
|---|---|---|
TYPE | Yes | totp for time-based codes or hotp for counter-based codes |
LABEL | Yes | Usually Issuer:account, URL-encoded, for example GitHub:alice. Shown in the app's list |
secret | Yes | The shared key in Base32, normally without = padding |
issuer | Recommended | The service name; should match the prefix of the label |
algorithm | No | SHA1 (default), SHA256 or SHA512 |
digits | No | 6 (default) or 8 |
period | No, TOTP only | Seconds per code, default 30 |
counter | Yes for HOTP | The starting counter value |
Some apps ignore the optional parameters and always use SHA1, 6 digits and 30 seconds. If a service uses anything else, check that your app supports it, or test the key in our TOTP generator, which lets you set the algorithm, digits and period by hand.
Examples
Plain TOTP account with defaults:
otpauth://totp/Acme:bob%40acme.com?secret=GEZDGNBVGY3TQOJQ&issuer=Acme
8-digit SHA256 code that changes every 60 seconds:
otpauth://totp/Bank:bob?secret=GEZDGNBVGY3TQOJQ&issuer=Bank&algorithm=SHA256&digits=8&period=60
HOTP counter-based account starting at 0 (try it in the HOTP generator):
otpauth://hotp/Acme:bob?secret=GEZDGNBVGY3TQOJQ&issuer=Acme&counter=0
All the sample keys on this page are public test values; never post a real one.
Google Authenticator export QR codes (otpauth-migration)
When you use Transfer accounts in Google Authenticator, the QR codes do not contain otpauth:// links. They contain otpauth-migration://offline?data=…, where data is a Base64-encoded protobuf message holding several accounts at once, each with its secret, name, issuer, algorithm, digits and type.
Other apps cannot always read that format. Our Google Authenticator export decoder unpacks it in your browser and gives you a normal key and otpauth link for every account. The step-by-step version is in how to transfer Google Authenticator.
Treat the URI like a password
Anyone who has the otpauth link or a picture of the QR code can generate your codes forever, until you reset 2FA on that account. Do not paste it into chats or tickets, delete screenshots once the key is safely stored, and only decode it with tools that run locally, like the ones on this site. Read more in is an online 2FA generator safe?
Frequently asked questions
What is an otpauth URI?
It is the text inside a 2FA QR code, in the form otpauth://totp/Issuer:account?secret=BASE32KEY&issuer=Issuer. It tells an authenticator app the secret key and settings needed to generate the account's one-time codes.
Which otpauth parameters are required?
The type (totp or hotp), a label and the secret. HOTP links also need a counter. The issuer is strongly recommended; algorithm, digits and period are optional and default to SHA1, 6 digits and 30 seconds.
How do I get the secret key from a 2FA QR code?
Decode the QR code to read its otpauth URI; the value after secret= is the Base32 key. A client-side QR reader such as otpgenerator.com's QR code to secret key tool does this in your browser without uploading the image.
What is otpauth-migration?
It is the format Google Authenticator uses for its Transfer accounts QR codes. The data parameter is a Base64 protobuf that can hold several accounts at once; a decoder turns it back into normal secret keys and otpauth links.