Your secret key is processed locally in your browser. It is not sent anywhere or stored. Treat secret keys like passwords, and for important accounts use a dedicated authenticator app.
🔒 100% Client-Side 📶 Works offline after loading
Advanced options
Enter a secret key to see your code.

How TOTP codes are calculated

A TOTP code is calculated from two inputs: a secret key shared between you and a service, and the current time. Time is divided into steps, 30 seconds by default, and the step number is combined with the key using HMAC (SHA-1 by default) to produce a short numeric code, as defined in RFC 6238. Because both sides calculate the code independently, only the code you type in needs to be sent to the service. If your device clock is noticeably off, the codes will not match.

When you set up an authenticator app, a service usually shows a QR code and often a text secret key. That text is the Base32 key this tool expects. Keep it private: anyone who has the key can generate your codes.

Key takeaways

  • TOTP codes are calculated from a secret key and the current time.
  • If your codes don't match, check your device clock first.
  • Never share your secret key with anyone.

Frequently asked questions

What is a TOTP code?

A time-based one-time password (TOTP) is a short code, usually 6 digits, calculated from a shared secret key and the current time. By default it changes every 30 seconds.

Is it safe to enter my secret key here?

This tool calculates codes in your browser and does not send or store your key. Even so, treat secret keys like passwords: for important accounts, prefer a dedicated authenticator app, and never share a secret key with anyone.

Why doesn't my code match the one from my app?

The most common cause is an incorrect device clock, because TOTP depends on accurate time. Also check that the secret key, number of digits, period, and algorithm match what the service gave you.

What is the difference between 2FA and TOTP?

Two-factor authentication (2FA) is the general idea of requiring a second proof of identity. TOTP is one common way to do it. Others include SMS codes and hardware security keys.