One-time password generator for a supplied secret

Calculate a time-based authentication code locally from your secret and settings. Your secret stays in this browser and isn’t saved by this page.

Secret and settings

Use your authorised setup secret, up to 256 characters.

Hash algorithm
Code length

Match your setup’s interval, from 1 to 300 seconds.

Whole Unix seconds. Leave empty to use your device clock.

Time-based code

94287082

Time until next code

1 second

Applied settings

SHA-1 · 8 digits

Public test example at Unix second 59. The test clock is fixed.

Public test example ready.

Enter the secret and protocol settings

This one-time password generator calculates a time-based authentication code from a supplied shared secret. Use it to test an account setup you’re authorised to manage.

The shared secret is the value your authenticator and account provider use to calculate matching codes. Enter the Base32 setup secret, not an account recovery code.

Base32 encoding writes bytes using letters A-Z and digits 2-7. This tool accepts lowercase letters, spaces and optional trailing padding. It rejects incomplete encodings and ambiguous digits such as 0 and 1.

Choose the algorithm and code length your setup specifies. Set its time step in seconds. The example uses SHA-1, eight digits and 30 seconds.

Your secret is processed locally. The page doesn’t put it in a URL, send it over the network, log it or save it in browser storage. Clear secret removes your entry and the displayed code. Reset example restores the public test values. Leaving the page clears the entry.

Copy code writes only the generated code to your clipboard. Clear secret doesn’t erase your clipboard, so replace its contents after use on a shared device.

Understand the changing code

A time-based one-time password (TOTP) depends on a shared secret and a time counter. The counter is the Unix timestamp divided by the time step, rounded down.

The TOTP protocol applies keyed hashing to that counter, extracts an integer and keeps the selected number of decimal digits. Leading zeroes remain part of the code.

With a 30-second step, Unix second 59 has counter 1. Second 60 starts counter 2. Time until next code shows how many seconds remain in that interval. A fixed test timestamp freezes both the code and countdown.

Use current time empties the test timestamp and follows your device clock. A wrong clock or mismatched secret, algorithm, digits or interval can produce a rejected code. This tool uses the Unix epoch as its starting point.

A randomly generated password is a separate credential. An SMS code comes from the account provider’s delivery process. This tool calculates neither of those.

Check an authorised setup

Reset example loads a fictional setup using the public RFC 6238 test secret. Its Base32 value is GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ. Never enrol this public secret in a real account.

At Unix timestamp 59, SHA-1 with eight digits and a 30-second step produces 94287082. One second remains before the next interval. With six digits, the same inputs produce 287082.

For your own authorised test, replace the example secret and match the account’s settings. Select Use current time for a live comparison, then clear your secret when finished.

Matching the arithmetic doesn’t enrol this tool in an account or recover a lost secret. If you’ve lost access, use the account provider’s recovery process.