Back to GreeLogix Blog
Authentication Fundamentals 8 min read Updated November 12, 2026

What Is TOTP? How Time-Based One-Time Passwords Work

A clear, practical explanation of TOTP (Time-Based One-Time Password): what those changing 6-digit codes are, why they expire, and how apps generate them offline.

What TOTP Means in Plain English

TOTP stands for Time-Based One-Time Password. Defined by the open IETF standard RFC 6238, it is the mechanism powering the rotating 6-digit (or 8-digit) verification codes inside authenticator apps across GitHub, Google, AWS, Shopify, Microsoft, and banking portals.

Unlike a text message code sent across a telecom network, a TOTP code is never transmitted to you during login. Instead, your authenticator app and the service's authentication server independently calculate the same temporary number at the exact same moment using a shared secret key and the current UTC time.

How Time-Based One-Time Passwords Work

Every TOTP setup follows a two-phase lifecycle—an initial enrollment handshake and ongoing offline verification:

  1. Setup Handshake: When you turn on 2FA inside an account, the server generates a random secret key (usually 16 to 32 Base32 characters) and encodes it inside an otpauth:// QR code.
  2. Local Key Storage: You scan or import that QR code into an authenticator app or Chrome extension. Both the server and your device now store the identical secret key.
  3. Time Window Calculation: At login time, your authenticator takes the current Unix time in UTC seconds and divides it by the configured period (almost always 30 seconds, occasionally 60 seconds).
  4. Cryptographic Truncation: An HMAC function (HMAC-SHA1, HMAC-SHA256, or HMAC-SHA512) hashes the shared key with that integer time step and extracts a 6-digit or 8-digit number.
RFC 6238 Verification Flow
SharedSecret = "JBSWY3DPEHPK3PXP" (stored once during setup)
TimeStep     = floor(CurrentUnixUTC / 30)
OTPCode      = Truncate(HMAC_SHA1(SharedSecret, TimeStep)) mod 10^6

Want to inspect algorithm parameters and SHA variants in detail? Review our engineering breakdown of RFC 6238 TOTP generation and supported hash lengths.

Why TOTP Codes Expire Every 30 Seconds

Short expiration windows limit the blast radius of shoulder surfing, phishing interception, and compromised logs. Because each passcode stays valid only for its active 30-second slice (plus a tiny server-side tolerance window of +/- 1 step to forgive minor clock skew), capturing a single code gives an attacker almost no window to reuse it later—and many servers strictly invalidate each code once used.

Clock Accuracy Matters

Because TOTP uses UTC time rather than internet lookups, your phone or PC clock must stay within ~30 seconds of real network time. If codes stop working offline, verify your system's automatic time synchronization.

How TOTP Differs From Static Passwords

PropertyStatic PasswordTOTP Code (RFC 6238)
LifespanValid indefinitely until manually changedRotates automatically every 30s or 60s
Exposure RiskReused leaks compromise multiple websitesSingle code expires quickly and proves key possession
Offline CreationMemorized or recalled from a password vaultComputed locally offline from secret + system clock
Role in SecurityKnowledge factor (something you know)Possession factor (access to device holding seed)

If you prefer generating these codes without picking up a mobile phone, read how an offline authenticator in Chrome computes matching codes locally inside your desktop browser.

Independence Notice: Secure TOTP Authenticator is an independent browser extension developed by GreeLogix. It is not affiliated with, endorsed by, or officially connected to Google or Google Authenticator.
Secure TOTP Authenticator Chrome extension icon
Secure TOTP Authenticator · Chrome Extension

Put Local, Offline 2FA Into Your Chrome Workflow

Generate 6- and 8-digit TOTP codes offline on Windows, macOS, or Linux, import Google Authenticator QR batches, and keep encrypted JSON backups.

No signup required Works offline Encrypted local JSON backup
Common Questions

Frequently Asked Questions

Direct answers covering compatibility, security boundaries, offline behavior, and backups.

No. Once the shared secret key is saved during setup, your device calculates new codes purely from math and its internal clock.