Skip to content
M2TOOLKIT

Security · free tool

2FA TOTP Code Generator

Generate 2FA codes from a secret key, or create a new secret with a QR code.

Use it as often as you like — it's free, with no sign-up and no limits.

  • Security
  • Free
  • No sign-up
  • Runs in your browser
  • Updated
Digits
s

Enter or generate a secret to see codes.

For testing your own 2FA setup. Codes are computed in your browser with the Web Crypto API; the secret is never sent anywhere.

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us.

How to use the 2FA TOTP Code Generator

  1. Paste a Base32 secret, or generate a new one.
  2. Adjust digits, period or algorithm if your service uses non-defaults.
  3. Read the current code, or scan the QR code with an authenticator app.

What does this tool do?

TOTP (RFC 6238) is the algorithm behind Google Authenticator, Authy and similar apps: it combines a shared secret with the current time to produce a code that changes every 30 seconds.

This tool is useful for developers testing 2FA and for checking that an authenticator is set up correctly. Codes are computed with the Web Crypto API in your browser.

Why use it?

  • Standard RFC 6238 codes.
  • Setup QR code.
  • Previous and next codes.

Use cases

  • Developers testing 2FA login flows.
  • Checking that an authenticator app is set up correctly.
  • Learning how one-time codes work.

The setup URI behind the QR code

otpauth://totp/Example:ana@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example

Scan it with an authenticator app and the code there should match the code on this page. The defaults are 6 digits, a 30-second period and SHA-1.

Common mistakes

  • Pasting real account secrets on shared or untrusted computers.
  • A computer clock that's wrong, which makes codes fail.
  • Changing digits or period when the service uses the defaults.

Accuracy and limits

  • Keep 2FA secrets private — anyone with the secret can generate your codes.

Privacy

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.

Frequently asked questions

Why don't my codes match?

Check that your device's clock is correct and that the digits, period and algorithm match the service.

What is Base32?

An encoding using A–Z and 2–7, used for 2FA secrets.

Is my secret sent anywhere?

No. Codes are computed with Web Crypto in your browser.

Content last updated . See how M2Toolkit works.

Other tools people use alongside the 2fa totp code generator.