An OTP code is a one-time password: a short code, usually 4 to 8 digits, that works once and expires after a few minutes. Apps send it by SMS, email or an authenticator app to prove you control a number or device. If you have asked yourself what is an OTP code and why every sign-up wants one, this guide explains it from start to finish.
You will learn how codes are generated, how SMS verification works, where it is weak, and how to handle codes safely.
What is an OTP code, exactly
An OTP (one-time password) code is a temporary password that is valid for a single login or action and only for a short time. A service generates it, sends it to something you own, such as a phone number, and asks you to type it back. Matching the code proves you have access to that number or device at that moment.
The key word is one-time. A normal password stays the same until you change it. An OTP changes every time, so a stolen old code is useless.
You will also see other names for the same thing:
- Verification code
- Security code or confirmation code
- SMS code or text code
- Passcode or PIN in some banking apps
How OTP codes are generated
There are two common ways services create OTP codes. Both aim for the same result: a code that is hard to guess and quick to expire.
Server-generated codes sent by SMS or email
The service creates a random code on its servers, stores it for a few minutes, and sends it to you. When you type it in, the server compares the two. If they match and the time has not run out, you are verified.