HOTP Generator Online

Runs in your browser. Nothing is sent to us. Is it safe?

An HOTP generator creates a one-time code from a secret and a counter. Each time you ask for a new code, the counter goes up by one and the code changes, regardless of the time. This tool runs in your browser, so your secret is processed on your device and not sent to our server.

What HOTP is, in one minute

HOTP stands for HMAC-based one-time password, and it is specified in RFC 4226. It came before TOTP and is the foundation TOTP was built on. The difference is what moves the code forward. In TOTP it is the clock. In HOTP it is a counter: a number that starts at a value both sides know and increases by one every time a code is used.

That makes HOTP useful where there is no reliable clock, which is why you meet it most often in hardware tokens with a button, and in some enterprise and industrial systems. Most consumer websites use TOTP instead; if you are not sure which you have, check our TOTP vs HOTP guide or see whether the setup screen asks for a counter.

How to generate an HOTP code

  1. Get the secret and the counter. The service or token vendor provides a Base32 secret and, often, a starting counter. If you have an otpauth://hotp/... link, the otpauth URI decoder will read both for you.
  2. Paste the secret. Paste the Base32 secret (or the whole otpauth://hotp/... link) into the generator, and choose HOTP rather than TOTP.
  3. Enter the counter. Use the exact counter value you were given. Set digits (6 or 8) and algorithm (SHA-1 is the usual default) to match.
  4. Get and copy the code. The code for that counter appears at once. Press Copy and paste it into the service.
  5. Use it, then move on. After you use a code, the counter increases so the next code is different. Press "Save to my accounts" if you want the counter remembered in the optional encrypted vault; without it, nothing is kept and Clear wipes the key.

Why the counter is the whole story

With HOTP the code is a function of two things: the secret and the counter. Change either and the code changes. Keep both the same and you will always get the same code, which is useful for testing and confusing for everyday use.

The risk is drift. Suppose you generate five codes but only use one. Your counter is now four ahead of the server's. A good server allows for this by checking a window of upcoming counters, but if you drift beyond the window, the codes are rejected until you resynchronise. Treat the counter like a number you must not lose track of:

  • Do not press "generate" for fun on an account that uses HOTP.
  • Write the counter down if you track a token by hand.
  • Ask the service about resync if codes stop working. Many have a procedure that takes two consecutive codes.

When an HOTP generator is useful

  • Reproducing a hardware token's codes that you hold the secret for, for example when migrating from a token to software.
  • Testing and development. The RFC publishes test vectors, so developers can check that their implementation matches the standard at each counter value.
  • Legacy systems that were set up with event-based tokens and never moved to TOTP.
  • Understanding the difference by comparing HOTP and TOTP output side by side.

HOTP versus TOTP at a glance

HOTP TOTP
Based on Secret + counter Secret + current time
Code lifetime Until used (or a later code is used) About 30 seconds
Common in Hardware tokens, specialised systems Authenticator apps, most websites
Main risk Counter drift Wrong device clock
Standard RFC 4226 RFC 6238

If your code is rejected

  • Check the counter. It must match the server's expectation, or be inside its look-ahead window.
  • Check digits and algorithm. A 6-digit code from an 8-digit setup will never match.
  • Check the secret. Base32 uses A to Z and 2 to 7 only.
  • Ask for a resync from the service if you have used or generated many codes.

Privacy

Calculation happens locally and nothing is sent to our server. In instant mode the secret stays in page memory only and is wiped on Clear or when you leave the page. If you save an account, it is encrypted with your passphrase (PBKDF2-SHA256 and AES-GCM-256) and stored only on your device. This page shows no ads and loads no analytics. See Is it safe? for the full explanation and how to check it yourself.

Related tools

Frequently asked questions

What is HOTP?

HOTP is the HMAC-based one-time password algorithm defined in RFC 4226. It creates a code from a secret and a counter that goes up by one each time a code is used, instead of from the time.

What is the difference between HOTP and TOTP?

HOTP codes depend on a counter and stay valid until used. TOTP codes depend on the clock and expire after a short period, typically 30 seconds. TOTP is far more common for websites; HOTP is typical for hardware tokens and some specialised systems.

Why does my HOTP code stop working?

The counter on your side and the counter on the server have drifted apart, usually because codes were generated but not used. Servers typically accept codes within a small look-ahead window and then resynchronise; if you are far outside it, you need to resync with the service.

What counter value should I start with?

Use the value the service gave you. If none was given, the standard starting value is 0, but check the service's instructions, because some begin at 1.

Does the counter increase automatically?

In a vault account the counter is stored with it and increases each time you generate a new code. In a one-off check you set the counter yourself.

Do HOTP codes expire?

Not by time. A code is valid for its counter value until the server has seen a later one. This is also why unused codes can cause drift.

Can I use HOTP for a hardware token?

Many event-based hardware tokens use HOTP. If you have the token's secret and know its current counter, this tool can reproduce its codes. Never share a token's secret with anyone you do not trust.

Is it safe to enter an HOTP secret here?

The calculation runs in your browser, and secrets are encrypted with your passphrase and stored only on your device. Try a test secret first and check the network panel yourself; our safety page shows how.

Optional

Save accounts in an encrypted vault (optional)

Want your codes kept on this device? Create a vault protected by your passphrase. Skip it if you only need a code right now.