Verifying an authenticator integration during development
Generating a code from a known secret confirms your server's verification logic, window tolerance and base32 decoding are correct.
Generates the current 6-digit TOTP code for a Base32 secret (RFC 6238).
Generates the current 6-digit TOTP code for a Base32 secret (RFC 6238).
secret: JBSWY3DPEHPK3PXP
123456 (current 30-second window)
Codes change every 30 seconds.
The code is time-based: it changes every 30 seconds.
Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.
curl -X POST "https://yas.sh/api/v1/tools/totp-generator" \
-H "Content-Type: application/json" \
-d '{"secret":"JBSWY3DPEHPK3PXP"}'const res = await fetch("https://yas.sh/api/v1/tools/totp-generator", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"secret": "JBSWY3DPEHPK3PXP"
}),
});
const data = await res.json();import requests
r = requests.post("https://yas.sh/api/v1/tools/totp-generator", json={"secret":"JBSWY3DPEHPK3PXP"})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| secret | string | Yes | Base32 TOTP secret |
{ "secret": "JBSWY3DPEHPK3PXP", "code": "123456", "secondsRemaining": 12, "period": 30 }Generate the current 6-digit TOTP code from a base32 secret.
400 VALIDATION_ERROR — invalid input or unsupported option.413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).TOTP (RFC 6238) is HOTP (RFC 4226) with a time-derived counter. The counter is floor(unixTime / period), normally a 30-second step. HMAC-SHA1 is computed over that counter with the shared secret, then dynamic truncation selects four bytes from the digest using its last nibble as an offset, and the result modulo 10^6 gives the six-digit code.
Both sides derive the same code from the same secret and the same clock, with no network traffic between them — which is why an authenticator app works offline. It also means clock drift is the dominant failure mode: servers typically accept the adjacent windows (±1 step) to tolerate a small skew, and a device more than a minute out will fail every attempt.
Generating a code from a known secret confirms your server's verification logic, window tolerance and base32 decoding are correct.
If the code here matches the user's app but the server rejects it, the fault is server-side — usually clock skew or a mis-decoded secret.
A shared test account whose authenticator lives on someone else's phone can be reached with the enrolment secret.
Watching the code change every 30 seconds from a secret and a clock demystifies the mechanism.
What this tool deliberately does not do, and where it will disagree with other implementations.
Paste a TOTP secret to see its current 6-digit code.