About this tool
HOTP (HMAC-based One-Time Password, RFC 4226) is the counter-based ancestor of TOTP. Each code is an HMAC of a shared secret and a counter; the counter goes up by one every time a code is generated, for example each press of a hardware token’s button. YubiKeys (OATH-HOTP), older key-fob tokens and some banking devices use it. This generator shows the codes for any counter and checks a code the way a server does.
Secrets stay in this page: nothing is sent or stored.
How the counter works
The token and the server each keep a counter. When a code is accepted, the server stores the next counter value. If the user presses the button without logging in, the token’s counter gets ahead, so servers accept codes within a look-ahead window (often 10) and then resynchronise. This tool’s checker does the same and tells you how far ahead a code was.
How HOTP is calculated (RFC 4226)
hmac = HMAC-SHA1(secret, counter as 8 bytes, big-endian)
offset = hmac[19] & 0x0f
binary = (hmac[offset..offset+3] as a 31-bit integer)
code = binary mod 10^6
With the RFC’s test secret 12345678901234567890 (Base32 GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ), the first codes are 755224, 287082, 359152: try it above.
HOTP vs TOTP
- TOTP codes expire after 30 seconds; HOTP codes stay valid until used, which makes stolen HOTP codes riskier.
- HOTP needs no clock, which suits simple hardware tokens.
- For new apps, prefer TOTP or passkeys.
FAQ
What is HOTP?
An HMAC-based one-time password defined in RFC 4226. Each code is derived from a shared secret and a counter that increases with every code.
What is the difference between HOTP and TOTP?
HOTP uses a counter that increases per code; TOTP uses the current time divided into 30-second steps. TOTP codes expire, HOTP codes don’t until used.
Why is my HOTP code rejected?
The token’s counter has probably moved past the server’s look-ahead window. Resynchronise by entering consecutive codes, or check the counter here.
Can I test with the RFC example?
Yes. Use the secret GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ and counter 0: the codes start 755224, 287082, 359152.