AltF Authenticator
TOTP secret key generator
Generate a random 2FA secret of 20 bytes (160 bits), encoded as 32 Base32 characters, using your browser's crypto.getRandomValues. That is the secret length RFC 4226 recommends, and every standard authenticator app accepts it. The secret is made and shown in your browser only.
- Free, no sign-up
- Secrets stay in your browser
- RFC 6238 self-test built in
- Works on mobile
How long should a TOTP secret be?
RFC 4226 requires a shared secret of at least 128 bits and recommends 160 bits. 160 bits is also the output size of SHA-1, the default HMAC for TOTP. If you use HMAC-SHA-256 or SHA-512, a longer key of 32 or 64 bytes matches those hash sizes, but 160 bits of real randomness is already far beyond guessing.
Why Base32?
Base32 uses only the letters A to Z and digits 2 to 7, so a secret can be read aloud or typed without confusing 0 with O or 1 with l. Every 5 bytes become 8 characters, so 20 bytes become exactly 32 characters with no padding. Apps usually ignore spaces and lower case when you type one in.
Generating secrets on your server
- Use a cryptographically secure random source, such as crypto.randomBytes in Node.js or secrets.token_bytes in Python. Never use Math.random or a timestamp.
- Make a new secret for every user and every enrolment. Never reuse one.
- Store the secret encrypted at rest. Unlike a password it cannot be hashed, because the server needs it to compute codes.
- Confirm enrolment by asking for a valid code before you switch 2FA on.
Use this generator for tests
This page is a handy way to make secrets for development, demos and test accounts. For production, generate secrets inside your own backend so they never pass through a person's screen more often than needed.
TOTP secret key generator: questions and answers
Is the secret truly random?
It comes from crypto.getRandomValues, the browser's cryptographically secure random number generator, which draws on the operating system's entropy source.
Can I make a secret longer than 160 bits?
RFC 4226 allows longer secrets and most apps accept them. 160 bits is the recommended length and the most widely compatible.
Does AltFTool keep a copy of the secret?
No. It is generated in your browser and never sent to a server.
Can I use a password as a TOTP secret?
No. A secret should be random bytes. A human-chosen word gives far less randomness and makes codes easier to predict.
Authenticator tools and 2FA guides
Guides
AltFTool never receives your secrets or codes. The only network request any tab makes is the clock check, which asks AltFTool's server for the time and carries nothing else.