# Time-Based One-Time Password (TOTP)

> A short code that changes every 30 seconds. It is made from a shared secret and the time.

**Field:** Software Development  
**Category:** Auth  
**Also known as:** TOTP, One-Time Password, OTP Code, Authenticator Code

## Think of it like

Think of it like a code that changes every half minute. Only you and the site know how.

## Definition

A TOTP is a short code, usually six digits, that changes every 30 seconds. Your phone and the site share a secret, set up once with a QR code. Each side mixes that secret with the time now to make the same code. You type the code after your password. A stolen code is useless a minute later, because a new one has taken its place.

## Example

Emma logs in, then opens her authenticator app. It shows 492 817, she types it in, and she is through.

## Why it matters

It adds a second lock that a stolen password cannot open. It works offline, with no text message needed.

## Common mistake

Keeping the setup QR code in a photo album or in notes. Anyone who finds it can make your codes forever.

## Three principles

- **A shared secret.** Set up once with a QR code.
- **Based on time.** A new code every 30 seconds.
- **A second factor.** Typed after the password.

## Related terms

- [Multi-Factor Authentication (MFA)](https://learn.benibix.com/term/development/multi-factor-authentication)
- [Authentication](https://learn.benibix.com/term/development/authentication)
- [Passkey](https://learn.benibix.com/term/development/passkey)
- [Credential Stuffing](https://learn.benibix.com/term/development/credential-stuffing)
- [Unix Timestamp](https://learn.benibix.com/term/development/unix-timestamp)

![Two boxes, Emma's phone and the website. Each holds the same secret, from a QR code, plus the time now, and each shows the code 492 817. An arrow marked Emma types it runs from the phone to the website, and the codes match. A note under them says both sides move on to a new code every 30 seconds.](https://learn.benibix.com/diagrams/dev2-totp.svg)

---

Source: https://learn.benibix.com/term/development/totp
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
