About this tool
Time-Based One-Time Password (TOTP, RFC 6238) is the cryptographic standard driving modern Two-Factor Authentication (2FA/MFA) across Google Authenticator, Microsoft Authenticator, and GitHub. Based on a shared Base32 secret key and synchronized Unix time steps (typically 30 seconds), TOTP derives temporary 6-digit verification codes using HMAC algorithms. This tool calculates TOTP tokens locally in your browser with real-time countdown progress bars.
How to Use This Tool (Step-by-Step)
Enter Base32 Secret Key
Paste the raw 16-character or 32-character Base32 secret provided by your service. The parser strips spaces and normalizes casing.
Configure Step Window & Digits
Defaults to the universal 30-second window and 6 digits; customizable to 60 seconds or 8 digits for enterprise IAM systems.
View Dynamic Token & Countdown
The active 6-digit passcode renders in real time alongside a live second-by-second countdown bar. Copy with one click to log in.
Strict RFC 6238 Standard Compliance
Cryptographic output is 100% identical to Google Authenticator, 1Password, and Bitwarden across all major online platforms.
Live Visual Countdown Ring
Displays a real-time progress ring tracking the remaining window, refreshing seamlessly when the time step rolls over.
100% Client-Side Air-Gapped
HMAC transformations execute entirely inside local browser memory via Web Crypto. Your master 2FA secrets are never transmitted.
2FA Security Best Practices & Clock Drift Tips
- •Enable automatic network time synchronization: TOTP depends entirely on clock alignment. A 60-second drift causes servers to reject tokens as invalid.
- •Safeguard Emergency Backup Codes: Always store the one-time backup codes provided upon enabling 2FA offline. They are your only lifeline if your device is lost.
- •TOTP beats SMS 2FA: SMS codes are vulnerable to SIM-swapping and SS7 interception. App-based TOTP eliminates telecommunications attack vectors entirely.
Code & Transformation Examples
TOTP Cryptographic Derivation Flow Benchmark
• 共享主密钥 (Secret) : JBSWY3DPEHPK3PXP (Base32 编码)
• 当前时间戳 (Unix) : 1774000000
• 步长窗口 (Time Step) : 30 秒1. 计算计数器: Counter = floor(Timestamp / 30)
2. 计算散列值: Hash = HMAC-SHA1(Secret, Counter)
3. 动态截断码: 提取 Hash 尾部偏移量取 4 字节整数
4. 最终口令 : 取模 10^6 输出 6 位数字 (如: 648291)* As long as physical clocks remain in sync, client and server derive identical tokens completely offline.
Standard otpauth URI Format Specification
otpauth://totp/Example:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Example&algorithm=SHA1&digits=6&period=30• secret : Base32 编码的共享主私钥
• issuer : 账户所属的企业或服务商名称
• digits : 口令位数 (通常为 6)
• period : 刷新周期 (通常为 30 秒)* The QR code scanned by authenticator apps simply encodes this standard `otpauth://` URI.
Frequently Asked Questions
Q: Why does TOTP work completely offline without internet?
A: TOTP requires zero network connectivity. The secret is saved locally during initial pairing; subsequent tokens derive purely from the device's hardware clock.
Q: How do servers tolerate slight clock drifts and latency?
A: RFC 6238 recommends servers accept tokens from the immediate previous and next time steps (a ±30-second window) to accommodate network latency.
Q: What is the difference between HOTP and TOTP?
A: HOTP (RFC 4226) increments an event counter on each press without time expiry. TOTP replaces the counter with elapsed time intervals, expiring automatically.