October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

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

TOTP generates a one-time code from a shared secret and time-derived counter. Learn how its timing works, how verifiers accept codes, and why it is not phishing-resistant.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A time-based one-time password (TOTP) is a short code generated from a shared secret and the current time. An authenticator app or hardware token calculates it, and a sign-in service checks whether it matches. The common 30-second time step is the default in the standard—not a guarantee that every service accepts a code for exactly 30 seconds.

What TOTP means

TOTP stands for time-based one-time password. It is the time-driven form of HOTP, a one-time-password method whose changing input is an event counter. TOTP replaces that counter with one derived from time, so the authenticator and verifier can independently calculate the same code without sending the shared secret during each sign-in. The method is specified in IETF RFC 6238.

As an Amazon Associate I earn from qualifying purchases.

The authenticator may be a smartphone application or a dedicated hardware device. In either case, it must have the secret and compatible settings needed to generate the code. The sign-in service must have the corresponding secret, or a way to derive it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How TOTP generates a code

TOTP uses the current Unix time to calculate a time-step counter, then applies the HOTP calculation to that counter and the shared secret. The standard expresses the counter as:

#1 Best Overall
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

T = floor((current Unix time − T0) / X)

  • T is the time-step counter.
  • T0 is the starting time. The RFC default is 0, the Unix epoch.
  • X is the step size in seconds. The RFC default is 30 seconds.

With those defaults, the counter advances at each 30-second boundary. The RFC’s example gives a counter of 1 at 59 seconds after the epoch and 2 at 60 seconds. The authenticator and verifier need matching step settings and the same secret material to produce matching outputs.

RFC 6238 permits HMAC-SHA-256 and HMAC-SHA-512 as alternatives to the HOTP SHA-1 construction. That does not mean every service supports every algorithm or configuration; the service’s provisioning process determines what will interoperate.

Rank #2
Sale
Thetis Nano-A FIDO2 Security Key Hardware Passkey Device with USB Type A, TOTP/HOTP, FIDO2.0 Two Factor Authentication 2FA MFA, Works with Windows/mac/iOS/Android/Linux/Gmail/Facebook/GitHub/Coinbase
  • Ultra-Compact FIDO2 Security Key - Plug-and-stay or carry on a keychain. This USB-A hardware security key offers portable, always-on protection for desktop and mobile use. (Item Size: 0.75 X 0.74 IN x 0.25 IN)
  • USB-A Hardware Key for All Devices - Works with USB-A ports on PC, Mac, Android, and other laptop/notebook device. Enables secure, cross-platform login with FIDO2.0 passkey support.
  • FIDO Certified Security Key - Meets FIDO and FIDO2 standards. Works with Google, Microsoft, GitHub, Dropbox, and more. Please check service compatibility before purchase.
  • Passwordless Login with Passkey - Supports passkey login via WebAuthn and CTAP2. Enjoy password-free sign-ins where supported. Not all websites or services currently support passkeys.
  • Advanced Multi-Factor Authentication - Offers 200 FIDO2 passkey slots and 50 OATH-TOTP slots. Strong, flexible 2FA/MFA support across various apps and authentication platforms.

How long a TOTP code is valid

A code changes when the time-step counter advances, but rollover and acceptance are different things. A verifier may accept a code from a bounded window around the current step to allow for clock drift, network delay, and the time it takes someone to enter the code. The configured window is a verifier policy, not something that can be inferred from the 30-second default alone.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

RFC 6238 advises validators to account for prior time steps within their delay policy and warns that widening the window increases exposure; for network delay, it recommends no more than one time step. NIST’s current guidance, SP 800-63B-4, requires a defined lifetime based on expected clock drift over the authenticator’s lifetime, network delay, and claimant entry time. It also requires the verifier to accept a given OTP only once while it is valid, and calls for rate limiting; rate limiting is required when the authenticator output is less than 64 bits.

Rank #3
Thetis Nano-C FIDO2 Security Key Hardware Passkey Device with USB Type C, TOTP/HOTP, FIDO2.0 Two Factor Authentication 2FA MFA, Works with Windows/mac/iOS/Android/Linux/Gmail/Facebook/GitHub/Coinbase
  • Ultra-Compact FIDO2 Security Key – Plug-and-stay or carry on a keychain. This USB-C hardware security key offers portable, always-on protection for desktop and mobile use.(Item Size: 0.73 X 0.60 X 0.30 inches)
  • USB-C Hardware Key for All Devices – Works with USB-C ports on PC, Mac, Android, and USB-C iPhones. Enables secure, cross-platform login with FIDO2.0 passkey support.
  • FIDO Certified Security Key – Meets FIDO and FIDO2 standards. Works with Google, Microsoft, GitHub, Dropbox, and more. Please check service compatibility before purchase.
  • Passwordless Login with Passkey – Supports passkey login via WebAuthn and CTAP2. Enjoy password-free sign-ins where supported. Not all websites or services currently support passkeys.
  • Advanced Multi-Factor Authentication – Offers 200 FIDO2 passkey slots and 50 OATH-TOTP slots. Strong, flexible 2FA/MFA support across various apps and authentication platforms.

What TOTP does—and does not—protect against

TOTP is an OTP method based on possession of an enrolled secret. Because the secret is held by the authenticator and is also needed by the verifier to reproduce the output, RFC 6238 recommends secure storage and limiting access to that secret. NIST likewise requires strong protection of verifier-side symmetric keys.

A short lifetime does not make a code phishing-resistant. NIST states, “OTP authentication is not phishing-resistant.” A user can enter a live code into an impostor site, which can relay it to the legitimate service before it expires. A manually entered OTP is not bound to the intended website or sign-in session. NIST identifies cryptographic authentication with channel binding or verifier-name binding as phishing-resistant approaches; WebAuthn is an example of verifier-name binding.

Rank #4
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

TOTP’s one-time acceptance rule and rate limiting help address replay and guessing, but they do not make the method immune to credential theft or relay attacks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing an authenticator format

NIST lists both smartphone authenticator applications and hardware TOTP devices as examples. The choice is practical: verify that the service supports the device’s provisioning format, consider how you will access and protect its secret, and plan how you will recover access if the device is lost or unavailable. A dedicated token is still a manually entered OTP method, so it does not prevent phishing.

Best Value
Sale
Thetis Pro-A FIDO2 Security Key Passkey Device with USB A & NFC, TOTP/HOTP Authenticator APP, FIDO 2.0 Two Factor Authentication 2FA MFA, Works with Windows/macOS/Linux/Gmail/Facebook/Dropbox/GitHub
  • FIDO2/Passkey Authentication – Secure, passwordless login with supported platforms. Check if your intended service supports hardware keys before purchase. Works with Gmail, Facebook, GitHub, Dropbox, and more.
  • Enhanced Multi-Factor Authentication (MFA): Strengthen account security using either FIDO2.0 authentication or TOTP/HOTP codes, providing flexible options for added protection.
  • Universal Connectivity: Features USB-A and NFC compatibility, making it easy to use across various devices including PCs, Macs, iPhones, and Android phones for seamless integration.
  • Durable & Portable Design: Built with a 360° rotating metal cover for extra durability. Compact and lightweight, it easily attaches to a keychain for on-the-go convenience. No batteries or network required, ensuring dependable use anywhere.
  • FIDO Certified & Business-Ready: Certified for FIDO standards and supported by a range of management software suites, ideal for both individual users and enterprise deployment.

Standards and current guidance

RFC 6238, published in May 2011, defines the TOTP algorithm. NIST SP 800-63B-4 is the current NIST digital identity guidance; NIST’s publication page lists July 31, 2025, as its final publication date and says it supersedes SP 800-63B. The algorithm’s 30-second default is a parameter in the RFC, not a claim that all services use identical timing or acceptance policies.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.