Use this free TOTP generator to see the current one-time code for a setup key, with a countdown to the next change. You can also check a code you have been given against the current and nearby time windows. It follows RFC 6238 and runs entirely in your browser, so the setup key is never sent to a server.

A setup key is a password in disguise. Treat it like one: keep it private, and store it in a password manager, not in a document or chat.

How to use the TOTP generator

  • Show current code: paste the setup key to see the code and how many seconds it has left.
  • Check a code: paste the key, type the code you were given, and see whether it matches the current or a nearby window.
  • Settings: most sites use 6 digits, SHA-1, and a 30-second step. Change them only if the site says so.
  • Copy: click the code to copy it. The copied value is the code only, never the setup key.

How the code is calculated

  • Counter: the current Unix time in seconds ÷ the time step, rounded down.
  • HMAC: the counter is signed with the setup key using the chosen algorithm.
  • Truncation: four bytes are taken from the signature at an offset set by its last byte, then reduced to the number of digits.
  • Check window: the check mode looks at the previous, current, and next time step to allow for clock drift.

TOTP settings at a glance

SettingCommon valueWhat it does
Code length6 digitsHow many digits the code has.
AlgorithmSHA-1The hash used to sign the counter.
Time step30 secondsHow long each code stays valid.
Setup keyBase32 textThe shared secret used to calculate codes.

Worked example

The setup key used in many documentation examples is JBSWY3DPEHPK3PXP. With 6 digits, SHA-1, and a 30-second step, the code depends only on that key and the current time window, so every person using the same key sees the same code at the same moment.

Common TOTP mistakes

  • Wrong time on the device. Codes depend on the clock. If codes fail, check that the device time is set automatically.
  • Mismatched settings. A site that uses 8 digits or SHA-256 will reject a 6-digit SHA-1 code.
  • Extra spaces in the key. Spaces are ignored here, but a truncated key will produce the wrong code.
  • Reusing a code. A code works once. Wait for the next one if a site rejects a code you just used.

Frequently asked questions

Is this TOTP generator free?

Yes. There is no sign-up and no limit on how many codes you generate or check.

Is my setup key sent or stored?

No. The code is calculated in your browser and nothing is sent to a server. The key is cleared when you click Clear or close the page.

Should I use this for my real accounts?

For real accounts, use a dedicated authenticator app or a password manager that stores one-time codes. Anyone who sees your setup key can generate your codes, so only enter a real key on a device you trust.

Why does my code not work?

Check the setup key, the number of digits, the algorithm, and the time step. Also check that the device clock is accurate, since codes change every 30 seconds.

What does the check window mean?

A code is accepted if it matches the previous, current, or next time step. This allows for small differences between clocks.

Share this article