How to Generate TOTP Codes for Testing (RFC 6238)
It generates a random secret, because pasting a real one anywhere is worse than not
About TOTP Generator — Free Online Tool
TOTP Generator produces RFC 6238 codes from a random test secret by default, for checking an implementation — and says plainly that a real 2FA secret should never go into any web page.
HMAC via WebCrypto with RFC 4226 dynamic truncation. Shows the previous and next codes, because a correct verifier accepts a window of one step either side for clock drift.
Codes are derived from the secret inside this page. Nothing is transmitted — and that is still not a reason to paste a real secret.
Verifying your own TOTP implementation, understanding how enrolment works, testing a verifier’s drift window, and generating a test secret.
Also known as: 2fa code generator · authenticator code generator · otp generator · rfc 6238 totp · test totp secret · totp implementation test
When to use it
Because implementing TOTP correctly needs something to check against, and the failure modes are subtle enough that "it works on my machine" is not evidence.
How it works
The Unix time is divided by the step to give a counter. HMAC of that counter under the secret is truncated by the RFC 4226 dynamic-truncation rule and reduced modulo ten to the power of the digit count.
Why It Generates A Secret Rather Than Asking For Yours
A TOTP secret grants account access on its own — it is a password that never expires and cannot be rotated without re-enrolling. Pasting one into any web page is strictly worse than not doing so, regardless of what that page promises about where the data goes. This tool runs entirely in your browser and uploads nothing, and that is still not a good enough reason. So it generates a random 160-bit secret by default, which is what you want for testing anyway.
The Drift Window Is Why Three Codes Are Shown
TOTP depends on both sides agreeing what time it is. Phones drift, and a user may take fifteen seconds to type a code that was already near the end of its window. A correct verifier therefore accepts the previous and next step as well as the current one — a window of ±1, which is ±30 seconds in the standard configuration. All three are shown so you can confirm your verifier accepts the right set and rejects a step beyond it.
SHA-1 Is Not A Weakness Here
Almost every service uses HMAC-SHA-1 with six digits and a thirty-second step, and people reasonably ask whether SHA-1 is a problem. It is not: the collision attacks that retired SHA-1 for certificates and signatures do not apply to HMAC, which depends on a different property. SHA-256 and SHA-512 are offered because the RFC allows them, but almost nothing in the wild uses them and an app may simply fail against a non-standard configuration.
When Codes Are Rejected, It Is Usually The Clock
A correct secret and a correct implementation still fail if the device clock is wrong. On a phone, enabling automatic time fixes it; on a server, NTP. Before suspecting the secret, compare the device clock against a reference — TOTP is a time-based protocol and a two-minute drift breaks it completely, however correct everything else is.
How to Use TOTP Generator in 4 Easy Steps
Follow this simple guide to process your files in seconds directly inside your browser tab.
Provide Input for TOTP Generator
Paste your payload, code snippet, or string into the TOTP Generator editor workspace. A generator for time-based one-time passwords — the six-digit codes an authenticator app produces — built to RFC 6238.
Configure Formatting & Validation Rules
Select indentation preferences, minification, encoding options, or validation rules. Because implementing TOTP correctly needs something to check against, and the failure modes are subtle enough that "it works on my machine" is not evidence.
Run In-Browser Engine
The engine executes TOTP Generator locally in your browser with microsecond latency and zero server transmission.
Copy or Download Output
Copy the sanitized, formatted, or generated output directly to your clipboard or download it for your project.
Why Use TOTP Generator on ShortTrick
Engineered for maximum speed, strict privacy, and frictionless digital productivity.
Zero Code or Token Leaks
Proprietary source code, API keys, database queries, and tokens processed in TOTP Generator never leave your browser.
Microsecond Performance
Optimized AST parsers and Web Crypto APIs process large payloads in TOTP Generator in milliseconds.
Syntax Validation & Formatting
TOTP Generator highlights syntax errors and enforces standard formatting conventions automatically.
Offline Ready
Once loaded, TOTP Generator functions entirely offline without requiring an active internet connection.
Frequently Asked Questions About TOTP Generator
Common questions regarding TOTP Generator, data privacy, file format compatibility, and usage limits.
Popular Searches & Related Tasks for TOTP Generator
Common search phrases, secondary format tasks, and workflows users reach for when using this tool.
Direct Variations & Search Synonyms (8)
Specific Workflows & Long-Tail Queries (15)
Semantic Standards & Technical Entities (20)
Identifiers and secrets are not the same thing
These all come out as a random-looking string, so they get used for each other’s jobs. The dividing line is whether the string is merely unique or must also be unguessable, and getting that the wrong way round is a security bug rather than a style choice.
| Must be unique | Must be unguessable | Expires | Safe in a URL | |
|---|---|---|---|---|
| UUID v4 | Yes | Not guaranteed | No | Yes |
| GUID | Yes | Not guaranteed | No | Yes |
| API key | Yes | Yes | When revoked | No |
| TOTP code | No | Yes | Every 30 seconds | No |
| JWT | Yes | It is signed, not secret | At its exp claim | Only if short-lived |
In practice: GUID is simply Microsoft’s name for a UUID, so the two tools produce the same thing. The one that catches people out is the JWT: it is signed, not encrypted, so anyone holding it can read every claim inside by decoding the middle section. Never put anything in a JWT payload that the bearer should not see.
Related Developer Tools Tools & Popular Utilities
Explore complementary browser-based tools with zero file uploads and instant in-memory execution.
More Developer Tools Tools
Popular Tools Across Other Categories
Related Reading & Tutorials
Guides, articles, and best practices for developer tools workflows.

How to Generate TOTP Codes for Testing (RFC 6238)

How Fancy Text Generators Work (And What They Cost)
