How to Generate TOTP Codes for Testing (RFC 6238)
Implementing TOTP correctly needs something to check against, and the failure modes are subtle enough that "it works on my machine" is not evidence. This produces RFC 6238 codes from a generated test secret, shows the drift window, and gives you the otpauth URI.
A random test secret is generated for you. You get the current code, the previous and next ones, and the otpauth URI.

Workflow Lifecycle & Pipeline
Visual execution flow showing how TOTP Generator processes data directly in your local browser sandbox.
TOTP Generator Interactive Process Pipeline
Fast, zero-latency execution directly in your browser memory.
Before You Start
Ensure your source assets and browser environment meet the verified execution requirements.
Step-by-Step Instructions
Follow these verified steps to execute the task with TOTP Generator.
Enter base32 secret (leave empty to generate one)
Fill in base32 secret (leave empty to generate one), digits and step (seconds), plus the 1 below. Each starts at a usable value, so you can change one and leave the rest.
Base32 secret (leave empty to generate one) blank · Digits 6 · Step (seconds) 304 fields read on runPress Generate Code
Generate Code starts the work in this tab. Nothing is uploaded, so how long it takes is down to your own device.
Generate CodeTOTP Generator runs on your deviceDownload the TXT
The result appears with a download button, as TXT. It was made on your device, so nothing has to be cleaned up afterwards.
Under the Hood: Sandboxed WASM Execution & Isolated Web Workers
Development tools and code sandboxes execute inside sandboxed Web Workers with isolated thread runtimes. Code scripts cannot access DOM scopes, cookies, or local network interfaces, providing high security and bare-metal performance.
Real-Time Stdin Stream
Interactive inputs pipe directly into std::cin, sys.stdin, and ReadLine buffers via simulated virtual teletypes.
Zero Egress Guarantee
Algorithm logic, API keys, and test queries remain confined to the client virtual machine.
Near-Native CPU Performance
Precompiled WebAssembly modules execute with near-native JIT performance on V8 and SpiderMonkey engines.
Settings & Options Explained
Fine-tune quality, format, and compression parameters for your exact workflow.
Settings & Configuration Guide
| Setting | Recommended Value | How It Works & Impact |
|---|---|---|
| Base32 secret (leave empty to generate one) | Leave it blank unless you need it | Never paste a real 2FA secret into any web page, including this one. Takes text. Impact: Read as written, so stray spaces and characters count. |
| Digits | 6 | Takes one of 6, 7 or 8. Impact: Each option is a different digits; switching it changes the result, not the speed. |
| Step (seconds) | 30 | Takes one of 15, 30 or 60. Impact: Each option is a different step (seconds); switching it changes the result, not the speed. |
| Algorithm | SHA-1 | Takes one of SHA-1, SHA-256 or SHA-512. Impact: Each option is a different algorithm; switching it changes the result, not the speed. |
Best Practices & Key Considerations
Avoid common quality pitfalls and maximize output performance.
Expert Recommendations
- Never paste a real 2FA secret into any web page, including this one. It grants account access on its own, never expires, and cannot be rotated without re-enrolling. The tool generates a random 160-bit secret by default for exactly this reason.
- Three codes are shown because a correct verifier accepts the previous and next step as well as the current one — ±30 seconds in the standard configuration. Confirm yours accepts that set and rejects a step beyond it.
- SHA-1 is not a weakness here. The collision attacks that retired SHA-1 for certificates do not apply to HMAC, which relies on a different property. SHA-256 and SHA-512 are allowed by the RFC but almost nothing in the wild uses them.
- When a real service rejects correct codes, it is almost always device clock drift rather than a wrong secret. Check the clock against a reference before suspecting anything else.
- Pair the otpauth URI with the QR code generator on this site to see the whole enrolment flow an authenticator app goes through.
Common Mistakes to Avoid
- Leaving Digits on 6 when 7 or 8 was wanted.
- Assuming the input is sent somewhere — TOTP Generator runs in this tab, and nothing you enter leaves it.
Troubleshooting & Fixes
Quick solutions for common browser constraints, format issues, and edge cases.
Troubleshooting & Common Issues
The answer is right but not in the form you wanted
Possible Cause: Digits is set to 6, and it decides that.
Frequently Asked Questions
Everything you need to know about formats, privacy, and browser support.
Related Step-by-Step Guides
Explore companion workflows, optimization techniques, and verified tutorials.