Generate a Two-Factor QR Code — Free TOTP/HOTP Enrollment QR
Enter your account label, issuer, and secret into the Two-Factor QR Code Generator and it draws a scannable QR code you can hold up to any TOTP or HOTP authenticator app — Google Authenticator, Authy, or anything else that reads the standard format. Adjust the algorithm, digits, and period or counter fields first if the receiving app needs non-default settings, and the code redraws itself right there in your browser.
Ever found yourself staring at a configuration screen, wondering how to get that QR code into your authenticator app quickly and correctly? This two factor QR code generator gives you a scannable QR code from any base32 shared credential in seconds — entirely inside your browser, with no data ever leaving your device. Whether you are locking down a Google account, hardening a cryptocurrency exchange, or wiring automated time-based codes into a CI/CD pipeline, understanding how the tool works and how to interpret its output will save you from lockouts, clock errors, and avoidable gaps in login security.
How the Two Factor QR Code Generator Works Under the Hood
A two factor QR code generator is not simply a barcode maker — it is an implementation of RFC 6238, the open standard that governs time-based one-time passwords. When you supply a base32 secret key, the tool encodes it inside an otpauth URI, then renders that URI as a scannable QR code. Every major app — Google Authenticator, Authy, Microsoft Authenticator, Duo Mobile, Okta Verify, and Yubico Authenticator — reads the same URI format, which looks like this:
otpauth://totp/Issuer:[email protected]?secret=BASE32SECRET&issuer=Issuer&algorithm=SHA1&digits=6&period=30The otpauth scheme signals that this is a provisioning URI. The issuer name becomes the display name shown in your app. The digits parameter controls whether you receive a 6-digit code or an 8-digit code. The period parameter — almost always 30 — sets the code rotation interval in seconds. Most services use the default settings (SHA-1, 6 digits, 30 seconds); only change these if your service explicitly requires different configuration values.
All QR code generation happens locally using the browser Web Crypto API. Your secret is processed in the browser — it is never transmitted to any remote host and never stored anywhere outside your local browser session. Cybersecurity-conscious users can also disable network access entirely after the page loads, because the tool functions as a progressive web app (PWA) cached by a service worker, making it a capable tool for use without internet access.
Where to Find Your QR Code Secret Key
To obtain the shared credential, navigate to the privacy settings of any two factor authentication-compatible service and choose the option to enable two-factor authentication via an app. The service will display both a QR code and a plaintext base32 secret key — often hidden behind a link labelled "Can't scan the QR code?" or "Enter manually." That base32 secret key is what you paste into this generator. Base32 characters run A–Z and 2–7 only; there are no digits 0, 1, 8, or 9, and no lowercase letters, which eliminates ambiguous characters that commonly cause credential typo errors during manual entry if you need to manually type secret characters.
If you only have a QR code screenshot — for example, a saved image from a previous enrollment — you can upload that image directly to decode qr code data and extract the otpauth URI, populating the secret field automatically. This upload-and-decode flow is the same approach used by image upload scanners in tools like Beeceptor, and it is particularly useful when migrating accounts to a replacement device or re-enrolling after a reset.
TOTP vs HOTP: Choosing the Right One-Time Password Algorithm
The two major code-generation methods are TOTP (Time-based One-Time Password, RFC 6238) and HOTP (HMAC-based One-Time Password, RFC 4226). Understanding the difference matters when a service requires a non-default configuration.
- TOTP mode
- Generates a fresh time counter code every 30 seconds using the current Unix timestamp as the counter. No state needs to be shared between the app and the backend — both sides independently compute the same value. This is the default for virtually every consumer service: Google, GitHub, Microsoft, Facebook, Discord, Coinbase, and hundreds more. TOTP is the method this generator uses by default.
- HOTP mode
- Uses an incrementing counter instead of time. Each code is valid until used, and both the app and the backend must keep the counter in sync. HOTP mode is defined in the HMAC-based one-time password specification and is sometimes called a counter-based code. Some hardware security key implementations and legacy enterprise systems still rely on HOTP, but it is increasingly rare in modern access control scenarios.
Yubico Authenticator supports additional configuration including HOTP mode and non-standard hash functions such as SHA-256 and SHA-512 (HMAC-SHA256 and HMAC-SHA512). The Google Authenticator app, by contrast, has advanced options ignored when they deviate from the standard SHA-1 / 6-digit / 30-second defaults — so if you export a QR code with SHA256 configured and scan it with Google Authenticator, those extra parameters are silently discarded and the app falls back to SHA-1.
How the 30-Second TOTP Code Cycle Protects Your Accounts
The 30-second refresh is not arbitrary. Here is the precise process that produces each six-digit code, following the five steps defined in RFC 6238:
- 1. Shared secret. When you enable two factor authentication, both the service and your app agree on a random shared secret — typically a 160-bit (20 bytes) value encoded as a base32 secret key. This is what lives in the QR code. The base32 secret key must remain confidential: treat it like a passphrase.
- 2. Time counter. Divide the current Unix timestamp by the interval (usually 30) and floor the result. This integer advances by one every 30 seconds and is computed identically on both sides without any network call.
- 3. HMAC-SHA1. Compute an HMAC using SHA-1 (or SHA-256 / SHA-512 if configured) with the shared credential as the key and the 8-byte big-endian counter as the message. The output is a 20-byte cryptographic hash with strong encryption properties. Because HMAC is a collision-resistant construction, only a holder of the shared credential can reproduce the same hash.
- 4. Dynamic truncation. Mask the lowest 4 bits of the final byte of the hash to obtain an offset between 0 and 15. Extract 4 bytes starting at that offset, clear the most-significant bit, and interpret the result as a 32-bit integer. This dynamic truncation step comes directly from the HOTP specification in the counter-based OTP standard.
- 5. Modulo for digits. Compute the 32-bit integer modulo \(10^{d}\), where \(d\) is the digit count (typically 6). Pad with leading zeros to ensure the output is always the full digit width — for example, a result of 7 becomes
000007rather than a short code.
In mathematical notation, the full TOTP derivation is:
$$T = \left\lfloor \frac{\text{Unix\_time}}{30} \right\rfloor$$ $$\text{HMAC} = \text{HMAC-SHA1}(\text{secret},\, T)$$ $$\text{offset} = \text{HMAC}[19] \mathbin{\&} 0\text{x}0\text{F}$$ $$\text{code} = \left( \text{HMAC}[\text{offset}..\text{offset}+3] \mathbin{\&} 0\text{x}7\text{FFFFFFF} \right) \bmod 10^{6}$$Because codes rotate on a strict 30-second timer, a stolen code is useless the moment the window closes. This short code lifespan makes replay attacks computationally infeasible — a remote attacker who intercepts a code during transmission has, at most, a few seconds before it expires. Combined with a strong passphrase, this second factor blocks the vast majority of credential-stuffing and social engineering attack scenarios, even when a passphrase has been compromised in a data breach.
Generate QR Codes: Worked Examples
Paste Your Secret Key, Configure the Name, and Scan
The following worked example walks through how to make qr codes for a personal Google account using this free browser-based generator:
- Visit Google account settings. Go to myaccount.google.com → Security → 2-Step Verification → Get Started, choose Authenticator app, and tap Can't scan it? to reveal the plaintext base32 secret key.
- Paste the credential into the generator. Copy the base32 value (e.g.,
JBSWY3DPEHPK3PXP) and paste it into the Secret Key field. Set the service name field toGoogleand the account field to your Gmail address. Leave the hash function, digit count, and interval at their defaults (SHA-1, 6, 30). - The QR code renders instantly. The tool encodes the URI
otpauth://totp/Google:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Googleand renders it as a scannable image. No data is sent anywhere — generation is entirely local. - Scan with Authy or any compatible app. Open Authy, tap the + button, and point your camera at the displayed code. Authy reads the provisioning URI, creates the account entry labelled Google, and immediately begins generating rotating codes.
- Verify the first live code. Return to the Google setup page and enter the current six-digit code shown in Authy. If it matches, two factor authentication is fully active. Save your Google backup codes immediately.
Scan a QR Code Screenshot and Recover a Lost Account
Imagine this scenario: you switched to a replacement device, forgot to export your time-based credentials, and can no longer scan the original setup image from your old email. Here is the recovery flow using this two factor qr code generator:
- Locate your saved backup codes. Most services generate 8–10 single-use recovery codes during initial enrollment. Retrieve those codes from wherever you stored them — a credential vault, a printed sheet, or an encrypted note.
- Sign in using a backup code. On the sign-in form, choose Use a backup code or Try another way. Enter one of your stored recovery codes to regain account access.
- Disable and re-enable two factor authentication. Once signed in, navigate to the settings page, temporarily disable two factor authentication, and immediately re-enable it to trigger a fresh configuration page with a new QR code.
- Upload the new QR code screenshot. Take a screenshot of the new setup image, or use the upload function in this tool to decode qr code data and extract the fresh base32 credential automatically.
- Re-enroll on your replacement device. Scan the regenerated QR code with your app on the new device, verify a live code, and save the new backup codes to prevent a repeat lockout. Consider storing credentials inside a protected backup in Authy or 1Password to enable app syncing across devices.
Using the Live Code to Complete Identity Verification
After scanning, your app displays a six-digit code alongside a countdown timer. Enter that code into the sign-in form before the 30-second timer hits zero. Most backends accept codes within a ±1 window (one interval before and after the current window) to account for minor clock drift, so a code generated just as the timer expires is usually still valid. If the site rejects it, wait for the next code rotation and try again before assuming the shared credential is wrong.
Tip: If you are setting up two factor authentication for the first time on a service that shows an Advanced Options panel, leave those settings at their defaults unless your service documentation explicitly requires a different hash function or digit count. Many apps have advanced options ignored when they include non-standard settings, which causes codes to mismatch — a frustrating troubleshooting scenario that a simple default configuration avoids entirely.Compatible Services and 2FA Code Generator Methods Compared
Enable Two Factor Authentication on Google, GitHub, and Microsoft
This online 2FA generator is compatible with every service that implements the TOTP standard (RFC 6238). That covers essentially every major platform in 2026. Here are quick setup guides for the three most commonly requested services:
Google / Gmail: Visit myaccount.google.com → Security → 2-Step Verification. Choose Authenticator app, scan the displayed QR code with this generator or paste the base32 secret key manually, then confirm with a live code. Google also supports Google Prompt push notifications and FIDO2 hardware keys as supplementary factors for identity verification and access control on your account.
GitHub: Go to Settings → Password and authentication → Two-factor authentication → Enable. Select Set up using an app. Scan the QR code or copy the credential. GitHub requires two factor authentication for all contributors on sensitive repositories and also supports FIDO2 WebAuthn security keys such as a YubiKey as a second factor alongside time-based codes.
Microsoft / Outlook: Visit account.microsoft.com → Security → Advanced security options → Two-step verification → Turn on. Although Microsoft promotes its own app, any RFC 6238 TOTP tool — including this one — works identically. The same setup covers Outlook, OneDrive, Microsoft 365, Teams, and Xbox accounts simultaneously.
Enable Two Factor Authentication on Facebook, Instagram, Discord, and More
Facebook / Meta: Go to Settings & Privacy → Settings → Accounts Center → Password and security → Two-factor authentication. Choose Authentication app and scan the QR code or enter the shared credential manually. Always save Facebook's recovery codes — losing app access without them makes account retrieval extremely difficult.
Instagram, TikTok, and Snapchat: Each platform supports app-based two factor authentication through its Settings → Security menus and generates a QR code compatible with any RFC 6238 tool. Given the frequency of account takeover attacks targeting social media accounts for resale, enabling two factor authentication on every social media platform is essential for online safety.
Discord: Open User Settings → My Account → Enable Two-Factor Auth. Enter your passphrase, then scan the QR code or enter the base32 credential into this 2FA code generator. Save Discord's backup codes immediately after enabling — Discord requires them if you ever lose access to your app and cannot produce a valid code.
Fortnite / Epic Games: Visit epicgames.com → Account → Password and Security → Two-factor Authentication → Enable Authenticator App. Enabling two factor authentication on your Epic Games account also rewards you with the Boogiedown emote in Fortnite and protects linked accounts including Rocket League. Similar app support exists for gaming accounts on Steam, Roblox, and Twitch.
Cryptocurrency exchanges: Binance, Coinbase, Kraken, Gemini, KuCoin, and every other major crypto trading platform require two factor authentication for withdrawals. Enable app-based two factor authentication under each exchange's settings tab and store the shared credential in a protected backup inside your credential vault. Losing two factor authentication access to a crypto account without backup codes can permanently lock you out of your funds — the stakes are uniquely high compared to email or social media.
Comparing 2FA Methods: SMS, TOTP, Hardware Keys, and Passkeys
Not all two factor authentication methods offer the same protection. The table below compares the five main types you will encounter across services in 2026, evaluating each on protection strength, best use case, and everyday convenience:
| 2FA Method | Security | Best For | Convenience |
|---|---|---|---|
| SMS-based 2FA | Low — vulnerable to SIM swap attack and SS7 interception; NIST deprecated for high-value accounts | Fallback only; avoid for banking, email, crypto | Very High — works on any phone without an app |
| Authenticator apps (TOTP) | High — codes rotate every 30 seconds, immune to SIM swapping, no network required | Daily protection for virtually all accounts | High — fast code entry, works without internet |
| Hardware security keys | Very High — phishing-resistant MFA; cryptographic proof of physical possession via USB, NFC, or Bluetooth (U2F / FIDO2) | Primary email, credential vault, crypto accounts, corporate identity verification | Medium — requires carrying the key; YubiKey and similar devices are small but easy to lose |
| Push notification 2FA | Medium — convenient but vulnerable to MFA fatigue attack; apps include Duo Mobile and Okta Verify | Managed work devices with corporate MDM | Very High — one tap to approve |
| Biometric 2FA and passkeys | Very High — phishing-resistant by design; bound to device secure enclave via FIDO2 WebAuthn; Apple Face ID, Windows Hello, Android fingerprint | Modern passwordless sign-in on supported services | Very High — instant via Face ID or fingerprint scanner |
Our recommendation: use a TOTP app as your primary protection method for all accounts. Back your most critical accounts — primary email, credential vault, and crypto exchange — with a hardware key such as a YubiKey that implements the FIDO2 / WebAuthn standard. Avoid text message codes wherever a better option exists. Where a service offers passkeys, upgrade to them: passkeys built on the WebAuthn standard are gradually replacing both passphrases and TOTP on Google, Apple, Microsoft, GitHub, and PayPal, representing the future direction of user verification.
Troubleshooting, Security Practices, and Automating TOTP with the Online 2FA Generator
QR Code Will Not Scan or Secret Key Is Rejected
The most common causes of a QR scan failure are poor lighting, camera focus issues, and screen glare on a bright display. Try these fixes in order:
- Increase your screen brightness and move to a well-lit area to eliminate glare.
- Adjust camera distance — most phone cameras need 15–30 cm of clearance to resolve a QR code reliably. Point camera directly at the code without tilting.
- Download or screenshot the QR code and use the image upload scanner — an image upload scanner bypasses camera entirely and extracts the provisioning URI from the file.
- If the QR code still fails, choose the manual entry fallback: manually type secret characters directly into the app's Enter a setup key field. Remember that base32 characters are A–Z and 2–7 only; any 0, 1, 8, or 9 you see is almost certainly an ambiguous character being misread as O, I, B, or G respectively.
- If using a different rendering package (for example, swapping from qrcode.js to another package in a custom implementation), verify it correctly encodes the full provisioning URI including the service name parameter — missing parameters cause some apps to reject the code silently.
Clock Sync Issues Causing Invalid Code Errors
TOTP depends entirely on accurate time. If your device clock drifts even 60 seconds from the backend's clock, the time counter used by your app and the backend will diverge and produce an incorrect code every time. Fix clock drift by enabling automatic time sync:
- Android: Settings → System → Date & time → Set time automatically (enable)
- iOS: Settings → General → Date & Time → Set Automatically (toggle on)
- Windows: Settings → Time & language → Date & time → Set time automatically; sync now with time.windows.com
- Linux / Backend host: Ensure the NTP daemon (
systemd-timesyncdorntpd) is active and time synchronization is confirmed withtimedatectl status
After enabling automatic time sync, wait for the next 30-second window and try the code again. If the problem persists, the issue may be a credential typo rather than time skew — re-enter the base32 value from scratch rather than copy-pasting from a cached source. Remember to set time automatically on the backend side too when troubleshooting time mismatches in a web application; the app and backend must agree on the current timestamp within the allowed window.
Account Locked Out — Recovery Steps
Losing access to your app — through a lost phone, factory reset, or broken device — is the most stressful scenario. Work through these recovery steps in order:
- Try your backup codes. Most services accept a single-use backup code in place of a live time-based code. Retrieve your recovery codes from wherever you stored them (credential vault, printed sheet, encrypted local storage, or encrypted note).
- Use an alternative second factor. Some services allow fallback to text message codes, a registered recovery email, or trusted contacts if your primary app is unavailable.
- Contact official support with identity proof. For a locked-out situation with no backup codes and no alternative factors, contact the service's support team directly. Expect to complete a government ID check or confirm financial details for banking and crypto account retrieval. Crypto platform recovery flows are particularly strict — expect a multi-day review.
- Never use third-party recovery services. Any website or individual claiming to recover your account for a fee is running a social engineering scam. Contact only official support channels.
Best Practices for Managing Your Two Factor Authentication Setup
Enabling two factor authentication is the starting point, not the finish line. The following practices keep your accounts protected against the evolving threats targeting multi-factor authentication in 2026:
- Always save your backup codes. Download and store the recovery codes every service generates at enrollment. Keep a copy in a credential vault and a second copy in an encrypted backup stored somewhere physically separate from your phone.
- Use multiple app devices. Export your time-based credentials using your app's export feature and import them onto a second device, or use Authy or 1Password, which support protected local storage and cross-device sync for those credentials so a lost phone does not lock you out.
- Beware of MFA fatigue attacks. If your phone starts receiving unexpected push approval requests — especially in the middle of the night — deny all of them and change your passphrase immediately. An MFA fatigue attack works by flooding you with approvals until you accidentally tap one.
- Guard against SIM swapping. Contact your carrier and request port-out protection and a carrier PIN on your SIM card. This single change prevents most SIM swap attacks where criminals social-engineer carriers into transferring your number to their own SIM card, giving them access to text message codes and account recovery flows tied to your phone number.
- Combine two factor authentication with a credential manager. Use unique passphrases per site, generated and stored by a password manager such as 1Password, Bitwarden, or LastPass, alongside TOTP. Some credential managers can store time-based secrets and autofill codes automatically, providing a seamless sign-in experience without sacrificing protection.
- Never share codes, even with support. No legitimate bank, service, or company will ever request that you read your verification code aloud, type it in a chat, or email it. Any request for a live code is a social engineering attempt — hang up and use the company's official contact channel.
- Audit your setup yearly. Conduct an annual review: list every account with two factor authentication enabled, confirm backup codes are current, enable it on newly created accounts, and revoke it from accounts you have closed. This hygiene practice catches stale recovery addresses and forgotten credentials before they cause problems.
- Upgrade to passkeys where available. FIDO2 / WebAuthn passkeys are phishing-resistant by design. A passkey is cryptographically bound to the specific domain it was created for, so a social engineering attempt against a fake sign-in page cannot harvest it. When Google, Apple, Microsoft, or GitHub offers passkeys, switch to them — they represent a genuine upgrade over TOTP.
Automating TOTP for CI/CD Pipelines and Test Automation
Code-based friction is one of the most common blockers in automated browser testing. Tools like Selenium and Playwright need to complete sign-in flows end-to-end, but a rotating six-digit code that expires every 30 seconds requires programmatic generation to avoid breaking the test suite. An endpoint-driven approach solves this without a physical device.
The REST endpoint accepts a QR code image via multipart/form-data using the qrcode field, or accepts a JSON request payload with the service name, shared credential, and hash function specified directly. The POST endpoint stores the time-based credential and returns a unique identifier along with the active code and an expiresAt timestamp:
curl -X POST \
-F "qrcode=@/path/to/qr.png" \
https://tools.beeceptor.com/2FA/TOTP/Alternatively, upload via JSON to configure the hash function explicitly (SHA256 is recommended for stronger hashing in automated workflows):
POST https://tools.beeceptor.com/2FA/TOTP/
Content-Type: application/json
{
"issuer": "your-ci-app.com",
"secret": "2OLRLATN3OQZOCPA",
"algorithm": "SHA256"
}The response payload includes the unique identifier, active code, and expiry window. In subsequent test runs, use the GET endpoint with the unique identifier to retrieve the active code without re-uploading the credential — the stored credential persists for 90 days of active use, after which an inactivity purge removes unused records automatically. The complimentary tier allows 10 requests per minute per IP; the paid endpoint tier at $10 per month unlocks 25,000 calls per month, longer credential retention, and priority support for enterprise needs. This usage-based pricing model makes programmatic access practical for teams of any size without requiring a sign-up at the complimentary level.
In a Playwright test suite, retrieve the active code programmatically and inject it into the sign-in flow's validation step before the code lifespan expires:
// Node.js / Playwright example
const res = await fetch('https://tools.beeceptor.com/2FA/TOTP/' + SECRET_ID);
const { otp } = await res.json(); // e.g. "002881"
await page.fill('#totp-input', otp);
await page.click('#login-submit');This pattern eliminates the need for a physical device during continuous integration runs, allows test suites to run fully headlessly in CI/CD workflows, and removes the manual step of generating codes. Because all HTTPS transfers use encryption and credentials are never exposed in response payloads beyond the active code, the protection model for automated validation remains sound. For development teams requiring a volume endpoint with rate limits above the complimentary tier, contact support about enterprise pricing. The permanent link for a registered credential also serves as a sharable bookmark so multiple team members can retrieve the active code without re-uploading credentials on every run.
Generating QR Codes Programmatically in ASP.NET Core
If you are adding two factor authentication to a custom web application rather than testing an existing one, ASP.NET Core Identity provides a built-in helper for the configuration page. The GenerateQrCodeUri method constructs the correctly formatted provisioning URI. Pass this URI to a rendering package such as qrcode.js to generate qr codes and display a scannable image in the browser:
window.addEventListener("load", () => {
const uri = document.getElementById("qrCodeData").getAttribute('data-url');
new QRCode(document.getElementById("qrCode"), {
text: uri,
width: 150,
height: 150
});
});To change the service name displayed inside the app after initial enrollment, update the name parameter in the provisioning URI and regenerate the QR code — users will need to scan the updated image and re-enroll. You can also switch to a different rendering package without affecting the underlying time-based logic, since the package is only responsible for encoding the URI into a barcode, not for computing codes. Always check that the app and backend times remain synchronised after a package swap, because some backend implementations cache the time counter in a way that introduces drift on the backend side.
For teams who want to use offline version builds of this tool: download the offline version, disable network access, and confirm that the source code matches the published hash before trusting it in an air-gapped environment. The data never leaves the browser in either the online or offline app — processed locally in both cases, with no data stored on any external host and nothing transmitted beyond your own device.
Frequently Asked Questions
- Which apps can scan this QR code?
- Any app that supports the otpauth:// URI scheme -- Google Authenticator, Authy, Microsoft Authenticator, 1Password, Bitwarden, andOTP, and most other TOTP/HOTP authenticator apps. This has been the de facto standard enrollment format since Google Authenticator's original implementation.
- Is it safe to generate my 2FA QR code in a browser tool?
- This tool builds the QR code entirely client-side -- your label, issuer, and secret never leave your device, and nothing is logged or transmitted. That said, treat the resulting QR code (and any screenshot of it) exactly like a password: anyone who scans it can generate valid codes for your account.
- What if my secret isn't Base32?
- Most services already give you a Base32 secret when they offer 'manual entry' as an alternative to their own QR code. If you only have a hex or raw-text key, convert it to Base32 first -- or use the TOTP Secret Generator to create a fresh, correctly-formatted one instead.
- Can I regenerate the secret without retyping everything else?
- Yes -- click the refresh icon inside the Secret field to fill it with a new random Base32 secret while keeping your label, issuer, and other settings exactly as they are.
- Do I need to fill in the Advanced Options?
- No. Algorithm (SHA1), digits (6), and period (30 seconds) are the universal defaults every authenticator app assumes. Only change them if a specific service's own setup instructions tell you to.