Skip to content

Time-based One-Time Password (TOTP)

What is a Time-based One-Time Password (TOTP)? 

Time-based One-Time Password (TOTP) is a popular form of two-factor authentication (2FA) that adds an extra layer of security to user logins.  

How does it work?

TOTP generates temporary codes using a shared secret key that is securely stored on both the user’s device and the server they are trying to access. The temporary code is valid for only a short period of time, typically 30 seconds, and is used in addition to a user’s password. 

Does TOTP work offline?

Yes, TOTP works offline because the user’s device generates the code using the shared secret key and the current time. The server that the user is trying to access does not need to be connected to the internet for TOTP to work. 


TOTP is a form of 2FA that is more secure than SMS 2FA. SMS 2FA involves sending a one-time code to the user’s phone via SMS, which can be intercepted by attackers or exploited through SIM swap attacks. TOTP 2FA, on the other hand, generates the code on the user’s device, which is more difficult for attackers to intercept. 

What is the difference between HOTP and TOTP?

HOTP (HMAC-based One-Time Password) is another form of a one-time password that is based on a counter rather than a timer. Instead of using the current time, HOTP uses a counter that increments each time a code is generated. This makes HOTP more secure in certain scenarios, such as when the device generating the code is not synchronized with the server’s clock. However, TOTP is more commonly used because it is easier to implement and more user-friendly. 

Why are TOTPs important?

TOTPs are important because they add an extra layer of security to user logins. By requiring a temporary code in addition to a password, TOTPs make it more difficult for attackers to gain access to user accounts. TOTPs are particularly important for protecting sensitive information, such as financial or medical data, and for preventing unauthorized access to corporate networks. Overall, TOTP is a simple yet effective security measure that can significantly reduce the risk of account takeover and data breaches.