Time-based one-time password meaning, in plain words

TOTP is the 6-digit code an authentication app changes every 30 seconds. How it is computed from time and a secret key, RFC 6238, and the fake-site weakness.

Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated

TOTP is the 6-digit code shown in an authentication app that changes every 30 seconds. The name is short for Time-Based One-Time Password. It appears in an app such as Google Authenticator and is used as one more check after the password.

How does TOTP work?

Imagine that the site and the app each hold one copy of the same code book. At login, both look at the clock and read out the number on the page for the current time. If they match, the person is judged to be genuine. The codes are not sent between them, so the app can show a code even where there is no signal.

In practice, when you register, the site and the app exchange a shared secret key. Scanning the QR code on the screen is that handover. After that, each side computes the same number from the secret key and the current time by the same procedure.

RFC 6238 is the document that defines this method. It divides time into fixed steps and produces a different number for each step. The standard step is 30 seconds, and the document recommends that value as a balance between security and ease of use. What a 6-digit code means is also covered in missing multi-factor authentication.

Why does TOTP matter?

Because it adds a light defense to an entrance protected only by a password. TOTP needs no SMS to arrive and works once you install an app. It suits an entrance that gets targeted, such as the admin screen of WordPress. Our Cyber Shield Guard Pro includes a function that adds a 6-digit code to the admin screen login.

You should know its weakness too. A fake site can collect a 6-digit code as you type it and replay it to the real site straight away. CISA points to FIDO and WebAuthn methods as the ones that hold up. TOTP is safer than a password alone, but not as strong as a passkey.

The QR code shown at registration, and the string beside it, are the secret key itself. Do not photograph the screen and put the picture in a shared folder. Keep recovery codes on paper in case a device is lost.

What should you do when you set up TOTP?

  1. Scan the QR code with an authentication app, and do not share the screen.
  2. Save the recovery codes on paper.
  3. Make sure the device's clock is set to automatic.
  4. Register a second device if the site allows it.

For help with setup, contact us.

If you manage accounts for a team, keep a short record of who has registered a device and who holds recovery codes. When a person leaves, remove their registration at the same time as their account.

Related terms

Frequently asked questions

Why does the code change every 30 seconds?

To cut the time a code can be used into short slices, so a stolen number is hard to use. RFC 6238 recommends 30 seconds as the standard time step, as a balance between security and ease of use. The shorter the validity, the shorter the time a glimpsed number stays useful.

What happens to TOTP when I replace my smartphone?

You need to register the same site again on the new device. While the old device still works, register the new one on the site's settings screen, or keep recovery codes at hand. Prepare a backup method in case a device is lost.

What happens if my smartphone's clock is wrong?

The code may not match and you may be unable to log in. Because the code is computed from the time, a large error in the device's clock stops it from agreeing with the site's result. Keep the device's time setting on automatic.

Next step

First check whether your admin screen login has a 6-digit code. The free URL check shows only what is visible from outside. For the steps to introduce it, or to choose between it and a passkey, contact us. The overall idea is in two-factor authentication.

Frequently asked questions

Why does the code change every 30 seconds?

To cut the time a code can be used into short slices, so a stolen number is hard to use. RFC 6238 recommends 30 seconds as the standard time step, as a balance between security and ease of use. The shorter the validity, the shorter the time a glimpsed number stays useful.

What happens to TOTP when I replace my smartphone?

You need to register the same site again on the new device. While the old device still works, register the new one on the site's settings screen, or keep recovery codes at hand. Prepare a backup method in case a device is lost.

What happens if my smartphone's clock is wrong?

The code may not match and you may be unable to log in. Because the code is computed from the time, a large error in the device's clock stops it from agreeing with the site's result. Keep the device's time setting on automatic.

See what an attacker can see, today

The free URL check returns a grade in under a minute. For costs and next steps, book a free consultation.