HOTP

HOTP (HMAC-based One-Time Password, RFC 4226) is the counter-based sibling of TOTP. Where TOTP advances on a clock, HOTP advances on a shared counter that both the token and the server increment with each code used. HOTP is the canonical mode for YubiKey OATH, legacy hardware tokens, and a handful of banking flows where the server can't rely on clock sync.

Canonical spec: RFC 4226 — HOTP: An HMAC-Based One-Time Password Algorithm (2005).
URI scheme: Google Authenticator Key URI Format — the otpauth:// scheme every authenticator agrees on.
Sibling spec: TOTP (RFC 6238) — time-based variant that builds on HOTP.

What it is

An HOTP enrolment QR is a URL in the otpauth:// scheme with hotp as the type. It carries the shared HMAC secret plus a counter value that both sides must keep in sync. Format:

otpauth://hotp/LABEL?secret=SECRET&issuer=ISSUER&counter=N&digits=N&algorithm=ALG

HOTP vs TOTP — when to use which

PropertyHOTP (RFC 4226)TOTP (RFC 6238)
Advances onCounter (each successful use)Clock (every 30 s)
Requires clock syncNoYes — within ~30 s drift
Resync on driftServer accepts next N counter valuesServer accepts ±1 window
Typical deploymentYubiKey, legacy hardware tokens, offline bankingEvery consumer 2FA — Google, Microsoft, 1Password, Authy
Counter reuseCatastrophic — leaks the secret over timeN/A
Vulnerability if secret leaksAll future codes predictableAll past + future codes predictable

Canonical test vectors

RFC 4226 Appendix D provides reference HOTP values for the secret 12345678901234567890 (20 bytes, Base32 GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ) with 6-digit output:

CounterHOTP (6-digit)
0755224
1287082
2359152
3969429
4338314
5254676
6287922
7162583
8399871
9520489

Minimal QR payload for enrolment at counter 0:

otpauth://hotp/Example:test?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Example&counter=0

Live Base32 secret validator

Same validator as the TOTP page — HOTP secrets use the identical Base32 alphabet (RFC 4648 §6: A-Z, 2-7). Runs in your browser, no server round-trip.

Enter a secret to validate.

Common pitfalls

Authenticator compatibility

App / tokenHOTPSHA256/5128-digitNotes
YubiKey Authenticator (iOS/Android/desktop)YesYesYesHOTP is the canonical YubiKey OATH mode. Full RFC 4226 support.
Google AuthenticatorYesIgnored (SHA1 only)Ignored (6 only)The de-facto baseline. Safe for HOTP but with 6-digit SHA1 only.
1PasswordYesYesYesFull RFC support. Counter is stored and exported with the entry.
BitwardenYesYesYesFull RFC support.
Microsoft AuthenticatorYesYesYesFull RFC support.
AuthyNoDropped HOTP in recent versions. TOTP-only.
Duo MobileNoUses its own push flow; TOTP-only fallback.
OATH hardware tokens (Feitian, Token2, etc.)YesVariesVariesCanonical hardware HOTP market; always 6-digit SHA1 unless the datasheet says otherwise.

See also

Spec references verified 2026-04-19. RFC 4226 (2005), Google Key URI Format.