Setting up two-factor login usually stalls on one awkward string. The OTPAuth URI builder turns your issuer, account name and secret key into a valid otpauth:// URI and a QR code that any authenticator app can read. It is a free security tool that runs in your browser, so you get a working TOTP setup without sending a secret to anyone.
How to Use the OTPAuth URI Builder
Five quick steps take you from raw values to a scannable QR code: For a safe setup on a mobile device, generate a two factor qr code locally in your browser and avoid sharing the image, which exposes the secret to a hacker.
- Enter the issuer. This is your service name, for example "Northwind Mail". Authenticator apps group entries under it.
- Enter the account name. Use the user's email address or username so each entry is unique.
- Paste the secret key. It must be a Base32 string; the tool rebuilds the URI live as you type.
- Confirm the defaults. Six digits, a 30 seconds period and SHA1 work with every app.
- Press Copy URI or Show QR, then scan the code with Google Authenticator or another of the authenticator apps you use, such as Authy or Microsoft's app.
Everything happens in your browser, which is a privacy advantage: your database and server never see the values until you decide to store them. Treat the finished link like a password, because it contains the shared secret.
URI String Format: Scheme, Type and Label
Every otpauth URI follows one uri string format: otpauth://TYPE/LABEL?PARAMETERS. Google first defined the otpauth URI scheme, vendor documentation such as Yubico's describes the otpauth URI format in detail, and the IANA registry lists it as provisional. An individual Internet-Draft now proposes common rules for producers and consumers of the URI so that every OATH-compatible app behaves the same way, and that interoperability is exactly what a standardised format buys you. Producers must emit well-formed values, while consumers should reject a URI that breaks the rules. Until that specification is final, the Internet-Draft is a work in progress, not a standard, and a second Internet-Draft covers similar ground. The builder follows the Google-style layout every authenticator app accepts, so its output works today. For an authenticator seed, the free totp secret generator produces a random Base32 shared secret with plenty of entropy.
Here is a complete URL with values of my own, followed by what each piece does:
otpauth://totp/Northwind%20Mail:dana.reyes%40northwind.example?secret=MFRGGZDFMZTWQ2LK&issuer=Northwind%20Mail&algorithm=SHA1&digits=6&period=30The scheme is otpauth, the type follows it, then comes the label, then the query parameters that carry the rest of the credential.
Choosing the TOTP or HOTP Type
The type decides how codes are produced. otpauth://totp is time-based: the code changes with the clock, almost always every 30 seconds. otpauth://hotp is counter-based: the code only advances when the user asks for a new one. Nearly every one-time password service uses TOTP, so pick HOTP only when a counter is required. Both produce one-time passcodes, but only HOTP needs the extra counter value.
Label: Issuer and Account Name
The label identifies one account and has the form Issuer:Account. The issuer prefix prevents collisions when two providers both use the same email as an account name. Keep a single literal or encoded colon between them. If you add the separate issuer parameter too, make the issuer parameter match the label prefix so apps do not show duplicate entries. Without an issuer, the app displays the account alone.
Key URI Parameters and Their Defaults
A key URI carries its settings as query parameters, and only the secret is required. The table lists each one, its default and what it accepts.
| Parameter | Default | Accepted values |
|---|---|---|
| secret | none (required) | Base32 text, no padding |
| issuer | none (recommended) | Service name, percent-encoded |
| algorithm | SHA1 | SHA1, SHA256, SHA512 |
| digits | 6 | 6, 7 or 8 |
| period | 30 | 15, 30 or 60 seconds (TOTP only) |
| counter | none | Initial counter (HOTP only) |
Secret Key in Base32
The secret key is the shared secret both sides keep to compute codes, and the builder's secret field expects this value and writes it into the URI as the secret parameter. The secret parameter holds a Base32 secret as defined in RFC 3548, so it only contains letters A to Z and the digits 2 to 7, and the padding should be omitted. Generate it with a cryptographically secure random source and store it in your database against the user's account, never in a log or a plain email.
Algorithm: SHA1, SHA256 or SHA512
The builder's algorithm option sets the hash algorithm and defaults to SHA1, which every app supports. SHA256 and SHA512 are valid but fewer apps, among them Google and Microsoft's, honour them, and Authy-style clients may ignore the choice. The app stores the algorithm at scan time, so changing it on your server later means users must re-enroll with a fresh code.
Digits, Period and Counter
The builder writes these values into the URI, and the digits value sets the length of the verification code, and 6 digits is the usual choice. The period is the validity period of each TOTP code in seconds. The counter appears only for HOTP, where it sets the initial counter that your server must verify against; the builder emits it only when HOTP is chosen.
Provisioning URI Percent-Encoding Rules
A provisioning URI must be percent-encoded wherever a character is outside the unreserved set. This is the same URL-encoded form defined in RFC 3986, and the tool applies the encoding for you.
- A space becomes
%20, so "Northwind Mail" is encoded in the label and issuer. - The at sign in the user's email address becomes
%40. - The colon between issuer and account may stay literal or become
%3A. - The secret never needs encoding, because Base32 uses only unreserved characters.
Percent-encoding mistakes are the commonest cause of an account name showing up wrong after scanning.
Building a Key URI for a Finance Admin Account
Marcus Okafor runs IT for a freight broker called "Harbor Freight & Co" and has to enroll the payments admin in two-factor login by Friday. Before touching the server code, I'd open the OTPAuth URI builder and test the string by hand.
He enters the issuer Harbor Freight & Co, the account name [email protected] and a fresh 16-character Base32 secret, L45JDQD34JGRRZVA, made from 10 random bytes. The tool returns a 168-character TOTP URI with SHA1, 6 digits and a 30-second period. Marcus decodes it back to check the label and issuer match, then scans the QR code with a phone.
What stands out is the ampersand. Left raw, it would end the issuer value early and the app would read " Co" as a stray parameter. The tool writes it as %26, alongside %20 for each space and %40 for the at sign, which is why the label shows correctly after the scan.
| Setup | Digits | Period | URI length |
|---|---|---|---|
| SHA1 defaults | 6 | 30 s | 168 characters |
| SHA256, longer code | 8 | 60 s | 170 characters |
| Secret and issuer only | assumed 6 | assumed 30 s | 134 characters |
Rerunning with SHA256, 8 digits and a 60-second period adds only 2 characters, so the QR code barely changes. The catch is compatibility: the minimal 134-character URI leans on app defaults, while the 170-character one only works if the user's app honours those three values. For a payments account, the number to watch is the algorithm, because one unsupported setting yields codes that never match. My judgement call is to ship SHA1 with 6 digits, and move to the stronger settings only after Marcus confirms the target app on a test enrollment.
QR Code Generator Steps for Authenticator App Enrollment
Show QR is the final step: the builder encodes the finished URI as a QR code, you register the account by letting the user's mobile authenticator app read it, and the registration is complete once the app has stored the credential on the device. A developer can pass the same URI into an API that returns a token or code for the mobile app, and that API then handles authentication with a fresh code. Registration is a one-time step per credential, and the same credential never needs a second registration unless parameters change. Keep each credential, from mobile enrollment to login, tied to one account. Deliver the enrollment email or page over a secure channel, since the secret in it unlocks every later login.
Scan with Google Authenticator
Open the app on a mobile device, choose the camera option, and point it at the QR code. The app reads the URI, adds the account and begins showing codes at once, with no typing.
Two-Factor Authentication After Enrollment
Test the URI the builder generated: after enrolling, compare the first code against the digits, period and algorithm you set in the tool, and generate the URI again if they differ. Once 2FA is live, authentication on every mobile client and API call relies on them, so keep those values stable and the user's password plus a fresh code keeps working.
Frequently Asked Questions
- What is an otpauth:// URI?
- It's the de facto standard URI scheme authenticator apps use for enrollment -- otpauth://TYPE/LABEL?secret=...&issuer=...&algorithm=...&digits=...&period=.... It was never a formal RFC, but Google Authenticator's original implementation became the shared convention every major app (Authy, Microsoft Authenticator, 1Password, Bitwarden) now supports.
- What's the difference between TOTP and HOTP?
- TOTP (time-based) generates a new code every fixed period (usually 30 seconds) based on the current time. HOTP (counter-based, the older of the two, defined in RFC 4226) generates a new code each time it's used, based on an incrementing counter both sides track. Almost all modern 2FA setups use TOTP; HOTP mainly appears in older hardware tokens.
- Why does the label include the issuer?
- Authenticator apps display the label to help users tell accounts apart. Prefixing it with 'Issuer:' (e.g. 'GitHub:[email protected]') lets the app group and label entries by service even if you have multiple accounts with the same username across different sites -- this tool does that automatically when you fill in the Issuer field.
- Do I need to change the algorithm, digits, or period?
- No -- leave them at the defaults (SHA1, 6 digits, 30-second period) unless a specific service's documentation tells you otherwise. Those are the universal defaults every authenticator app assumes when a URI omits them, which is why this tool only adds them to the output when you've changed them from default.
- Does this tool store or transmit my secret?
- No. The URI is built entirely in your browser from the values you type. Nothing is sent to a server, logged, or stored -- reload the page and everything is gone.