TOTP vs HOTP Comparison
Compares TOTP and HOTP characteristics in a table and shows how each derives the one-time code.
—
HOTP and TOTP: what actually differs
The six-digit codes in an authenticator app come out of a fairly simple algorithm: HMAC-SHA1 of a shared secret with a counter, truncated into a number. What separates HOTP from TOTP is only what goes into that counter. In HOTP it is an integer that advances on every use. In TOTP it is the clock: Unix time divided by the window size, normally 30 seconds.
That difference changes everything operationally. HOTP needs client and server to keep the same count, and a hardware token pressed inside a pocket drifts out of sync — hence the look-ahead window, where the server tries the next few codes, and the resynchronisation procedure after too many failures. TOTP has no such problem because nobody counts: both sides read the clock. In exchange, it now depends on that clock being right.
The page shows the comparison table and, in its other two modes, the step-by-step derivation of each — the dynamic truncation that takes its offset from the last nibble of the HMAC, the 0x7F mask on the first byte and the modulo by ten to the power of the digit count. It is reference material: it generates no codes and validates no secrets, it exists to show what your 2FA library is doing underneath.
Frequently asked questions
Why was my code rejected when I typed it quickly?
Is SHA-1 still used for this?
Can I use the same secret on two devices?
Related Tools
TOTP otpauth URI Builder
Builds an otpauth://totp/ URI with issuer, account, base32 secret, digits and period for QR code apps.
API Key Rotation Planner
Computes upcoming API key rotation dates based on an interval (30/60/90 days) and generates an iCal reminder.
Mixed Content Detector
Scans http:// references inside HTML served over HTTPS, flagging insecure assets and links.
Common Password Blacklist Check
Checks a password against the top 1000 most-used passwords, fully client-side, and flags it as compromised.
SAML Response Base64 Decoder
Decodes and indents base64-encoded SAMLResponse XML for inspection — useful for SSO debugging.
Password Strength Checker
Analyze the strength of any password: length, character classes, entropy in bits and resistance estimate. Processed in the browser — the password never leaves your device.