Australian Jeevitham TECHDeveloper tools

Tech / TOTP Code Generator

TOTP Code Generator

Generate the codes an authenticator app would show, from a Base32 secret, to test two-factor sign-in while you build it.

Settings

Current code

------
Previous-
Next-
Counter-

Authenticator link

How authenticator codes work

The 6-digit codes in apps such as Google Authenticator and Microsoft Authenticator are TOTP codes - time-based one-time passwords, defined in RFC 6238. When you set up two-factor sign-in, the website and your app share a secret key, usually by scanning a QR code. From then on, both sides combine that secret with the current time, in 30-second steps, using HMAC. They get the same code without talking to each other.

Why do codes sometimes fail?

  • Clock difference - if the phone's or server's clock is off by more than about 30 seconds, the codes do not match. Turn on automatic time on the phone and keep the server's time in sync.
  • Settings that do not match - the number of digits, the period and the algorithm must be the same on both sides. Most apps use 6 digits, 30 seconds and SHA-1.
  • A mistyped secret - Base32 secrets use only the letters A-Z and the numbers 2-7.

Many servers also accept the code just before and just after the current one, to allow for small clock differences - which is why this page shows the previous and next codes.

Testing two-factor sign-in safely

Use "New random secret" to make a test secret, then copy the authenticator link or turn it into a QR code with the QR code generator to add it to your phone. Never paste the secret of a real account into any website, including this one. The codes are worked out in your browser, and the secret is never sent or stored.