TOTP Generator
Enter the secret, digits, and period.
About this tool
The code uses HMAC-SHA1 for the current time step.
The secret is not chained and is not sent to analytics.
How to use it
- Open this page and provide the input it asks for.
- Set the options that are visible, then use Show code.
- Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.
Limitations
- The secret is not chained and is not sent to analytics.
RFC 6238 HMAC-SHA1 for the current step
The calculation
The secret box is trimmed, stripped of spaces, and uppercased. It must be base32 in the A-Z and 2-7 alphabet. Padding equals signs at the end are removed. Digits must be 6, 7, or 8. The period must be a number of seconds from 15 through 120. The defaults are 6 and 30. The moving factor is the Unix time in seconds, from the browser clock, divided by the period and floored. That counter is written as a 32-bit big-endian integer into the last four bytes of an eight-byte buffer. The key is the decoded base32 secret, imported for HMAC with SHA-1, which is the hash RFC 6238 specifies for the common TOTP profile. The MAC is truncated the usual way: the low nibble of the last byte picks an offset, four bytes are assembled, the high bit is cleared, and the integer modulo 10 to the power of the digit count is padded with leading zeros.
SHA-1 in this construction is the RFC’s HMAC, not a verdict that SHA-1 is sound for new signatures or for password storage. The hash page still marks SHA-1 as collision-broken for those uses. Here the hash is inside a one-time-code step. Do not copy the secret into a new signature scheme and cite this page as approval.
The secret stays on the page
The code is computed locally. The secret is not chained to another tool, and the digits never leave for analytics. It remains in the form because you typed it there. That is still a secret on the screen. Do not generate a code on a machine you do not trust, and do not leave the secret in a screenshot. The page does not enroll an account, does not scan a provisioning QR, and does not talk to the service that will check the code. The digits follow the clock and the shared secret, and both have to be right. If the browser clock is wrong by more than a step, the digits will not match the verifier’s step. The page does not show neighboring steps.
What it will not accept
An empty secret throws. A character outside the base32 alphabet throws. Digit counts other than 6, 7, and 8 throw. Periods outside 15 to 120 throw. The page does not implement HOTP’s counter you edit by hand, and it does not implement every hash the RFC allows. The implementation is HMAC-SHA1, dynamic truncation, and the current time step. Use it to read a code for a secret you already hold. Do not use it to invent a new authentication system, and do not treat the digits as a long-term password.
Privacy
Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.

