Generate TOTP codes and otpauth URIs
All computation runs locally in your browser

The OTP Code Generator helps you create TOTP codes and an otpauth URI(the standard format authenticator apps understand). You can also generate a QR code that encodes that URI, making it easy to import into an authenticator.
What problems does it solve?
Who is this for?
For accuracy, this tool follows the standard TOTP approach (HOTP + time counter). If you want to inspect related cryptographic building blocks, you may also like our HMAC Generator, Hash Text, or Password Strength Analyser.
Example 1: Understanding the countdown
If your period is and the current Unix time is , then the moving counter is:
That counter changes every seconds, which is why your code updates on a timer.
Example 2: Why digits matter
After HMAC and truncation, you get a 31-bit integer (call it ). The final OTP is:
If your service expects but your app uses , your codes will never match.
Backend implementation smoke test
Input: period , digits , plus the same secret your backend uses.
Result: your login server should accept the Current code. If it only accepts Previous, you likely have a time window shift.
Tip: if you also need to inspect the raw HMAC step, try the HMAC Generator.
Provisioning QR for an authenticator
Input: issuer (e.g. CalculatorVast) and account (e.g. demo-user) so the entry is recognizable on your phone.
Result: scan the QR code and confirm your app shows the same Current OTP.
Company-wide issuer naming policy
Input: issuer Acme Corp, account [email protected].
Result: your authenticator groups entries consistently; fewer support tickets about “which code is this?”.
Diagnosing a mismatch (digits/period/time)
Input: try both digits and , and a period of vs .
Result: once parameters match your service, your OTPs will align.
Security reminder: the secret is the “key” to your account’s TOTP. Treat it like a password—do not share it in screenshots, tickets, or public links.
Adding TOTP to a new service
Generate the otpauth URI and scan the QR code.
Fixing “invalid code” errors
Check period, digits, and device time sync.
Copying codes quickly
Click Previous/Current/Next to copy instantly.
Auditing issuer/account labels
Prevent confusion inside authenticator apps.
Testing recovery flows
Confirm what happens when codes expire or rotate.
Debugging provisioning URLs
Copy the URI and compare query parameters.
When it might not be the right tool
Practical tips
Want to evaluate secrets and passphrases more broadly? Pair this tool with the Password Strength Analyser, or use the BIP39 Passphrase Generator for seed phrase experiments.
TOTP is a time-based variant of HOTP. The main idea is to convert time into an integer counter and then apply HMAC.
1) Time counter
Here is Unix time in seconds, is the period (typically ), and is usually .
2) HMAC + dynamic truncation
A simplified view of the OTP step is:
Where is the secret key and is the number of digits.
3) Zero padding
If , the OTP is formatted as a 6-digit string. That means values like become .
What is Base32?
Many TOTP secrets are stored as Base32 so they can be typed without symbols. Valid characters are usually letters A–Z and digits 2–7. If you see a “secret invalid” warning, it often means the pasted value contains spaces, lowercase letters, or the wrong alphabet.
What is an otpauth URI?
Authenticator apps commonly accept a provisioning URL that looks like:
The QR code shown by this calculator is simply an image encoding that URI.
If you need to validate other encodings, you may also like our Base64 String Encoder/Decoder.
The most common causes are mismatched (period), mismatched (digits), or device time drift.
Usually no. The URI contains the secret. If someone has it, they can generate valid OTP codes.
Those are OTPs for the adjacent time windows. If your service allows a time tolerance, it may accept codes from or .
Yes—if your service is configured for . Otherwise, stick to .
The calculator is designed to run locally in your browser. Still, you should treat secrets as sensitive and avoid using real production secrets on shared machines.
Use a simple chronometer (stopwatch) to track elapsed time down to milliseconds. Runs locally in your browser.
Normalize email addresses to a standard format for easier comparison. Useful for deduplication and data cleaning. Runs locally in your browser.
Estimate the time needed to consume a total amount at a constant rate, and get an expected end time. Runs locally in your browser.
Parse and decode your JSON Web Token (JWT) and display its content. All computation runs locally in your browser.
Know which file extensions are associated to a MIME type, and which MIME type is associated to a file extension. Includes a full MIME types table.
Generate random Lorem Ipsum placeholder text with customizable paragraphs, sentences, and word counts. Runs locally in your browser.