Skip to content
OTP Generator

Guide

otpauth:// URI Format: The Key Inside Every 2FA QR Code

What a 2FA QR code really contains: the otpauth:// URI, its label, secret, issuer, algorithm, digits, period and counter parameters, with examples and the Google Authenticator migration format.

6 min readUpdated November 14, 2026Fact-checked against RFC 6238

Quick answer

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.

More answers
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.

PartRequired?Meaning
TYPEYestotp for time-based codes or hotp for counter-based codes
LABELYesUsually Issuer:account, URL-encoded, for example GitHub:alice. Shown in the app's list
secretYesThe shared key in Base32, normally without = padding
issuerRecommendedThe service name; should match the prefix of the label
algorithmNoSHA1 (default), SHA256 or SHA512
digitsNo6 (default) or 8
periodNo, TOTP onlySeconds per code, default 30
counterYes for HOTPThe 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.

Need a code right now?

Paste your key and get the current 6-digit code in seconds. Free, private and nothing to install.