# SMS verification code: how long, and how long valid?

> An SMS verification code usually has 6 digits, is valid for 5 to 10 minutes and allows only a few attempts. Recommended length, expiry, resend and sender.

Published: 2026-11-17 · 4 min read · Web version: https://topsms.eu/blog/sms-verification-code-length-validity · Deutsch: https://topsms.eu/de/blog/sms-bestaetigungscode-laenge-gueltigkeit.md · Español: https://topsms.eu/es/blog/codigo-verificacion-sms-longitud-validez.md · Italiano: https://topsms.eu/it/blog/codice-verifica-sms-lunghezza-validita.md · Português: https://topsms.eu/pt/blog/codigo-verificacao-sms-tamanho-validade.md

## In short

An SMS verification code should usually have 6 digits, be valid for 5 to 10 minutes, work only once and allow only a few wrong attempts. A new code should invalidate the previous one, and there should be a short pause between two sends. Put the name of your service at the start of the text and as the sender name.

Every login or sign-up flow with an SMS code has to settle the same four parameters: how long the code is, how long it stays valid, how many attempts and resends are allowed, and what the message looks like. This page gives the usual values and the ones used by the [TopSMS Verify API](https://topsms.eu/use-cases/otp-verification). Whether SMS is a strong enough second factor at all is a separate question, covered in [OTP via SMS: secure implementation guide](https://topsms.eu/blog/otp-sms-implementation).

## Recommended settings at a glance

| Parameter | Usual value | TopSMS Verify API |
| --- | --- | --- |
| Code length | 6 digits | default 6, optional 4 to 8 |
| Validity | 5 to 10 minutes | default 5 minutes, optional 1 to 30 minutes |
| Attempts per code | 3 to 5 | 5 |
| Pause before the next code | 30 to 60 seconds | 30 seconds |
| Cap per phone number | a few codes per hour | 5 codes per hour |
| Reuse | no | single use; a new code invalidates the previous one |

## Length: why six digits

A six-digit numeric code has one million combinations. That alone would not be enough, but combined with a limit on attempts the chance of guessing is negligible: five attempts cover 5 out of 1,000,000. Length and attempt limit therefore belong together.

[NIST SP 800-63B](https://pages.nist.gov/800-63-4/sp800-63b.html) asks for at least six decimal digits for secrets delivered over a second channel, which is where SMS belongs, and requires rate limiting for short secrets. Keep four digits for low-risk situations such as confirming a booking. Eight digits are harder to copy and add little for SMS.

Use digits only. Letters are harder to type on a phone and easy to confuse (O and 0, l and 1), and phones can offer a numeric code for autofill straight from the keyboard.

## Validity: 5 to 10 minutes

The code has to live long enough for the SMS to arrive and be typed in, and short enough for an intercepted code to lose its value quickly. In practice that means 5 minutes for login and sign-up and up to 10 minutes for account recovery, when the user may still be looking for the phone. NIST SP 800-63B considers the authentication invalid unless it is completed within 10 minutes.

State the validity in the message (“Valid for 5 min”) so the user knows when to ask for a new code, and invalidate the code immediately after a successful check.

## Attempts and resends

Two protections that are often mixed up:

- **A limit on wrong entries** protects against guessing. When the attempts are used up, invalidate the code and let the user request a new one.
- **A limit on sends** protects you against abuse of the form and the user against a flood of messages: a pause between two codes and a cap per number and hour. Without it anyone can use your form to send SMS to other people’s numbers at your expense.

Show the “Send again” button only after the pause, with a countdown. A new code should always invalidate the previous one; otherwise two codes are valid at once.

## Sender name and message text

The user should see at a glance who the code is from. A sender name and the same name at the start of the text both help:

```
MyShop: your verification code is 482913. Valid for 5 min. Do not share it.
```

- **One SMS.** The text above has 75 characters and stays within GSM-7, so it is billed as one message. German umlauts are fine; an emoji or a typographic quote would cut the limit to 70 characters and make it two. Check a text in the [SMS character counter](https://topsms.eu/tools/sms-character-counter); the limits are explained in [How many characters fit in an SMS](https://topsms.eu/blog/sms-length-characters).
- **No link.** A code is meant to be typed, not clicked. Links in verification messages train users to click and help fraudsters.
- **A warning.** “Do not share it” costs a few characters and counters the most common phone scam.
- **Sender name by country.** A name has up to 11 characters. Germany delivers it without registration, while Austria, Spain and Italy require the name to be registered; see [where sender ID registration is required in Europe](https://topsms.eu/blog/alphanumeric-sender-id-europe-registration).

## Setting it in the Verify API

The Verify API generates, sends and checks the code, so length, validity and limits need no code of your own. Sending:

```
POST /api/verify/send
{ "to": "+4915112345678", "brand": "MyShop", "locale": "en", "length": 6, "ttl": 300 }
```

`length` accepts 4 to 8 and `ttl` 60 to 1,800 seconds; if you omit them, 6 digits and 5 minutes are used. `locale` selects the English, German or Czech message text. The check is a second call, `POST /api/verify/check`. The code is never stored in readable form, and with a test key nothing is sent. The full reference is in the [API documentation](https://topsms.eu/docs#verify-api).

## Frequently asked questions

### How many digits should an SMS verification code have?

Usually 6. NIST SP 800-63B asks for at least six decimal digits for secrets sent over a second channel. A shorter code only makes sense for low-risk actions and always with a limit on attempts.

### How long should a verification code be valid?

5 to 10 minutes. Shorter periods fail when the SMS is delayed; NIST SP 800-63B treats an out-of-band authentication as invalid unless it is completed within 10 minutes. The default in the TopSMS Verify API is 5 minutes.

### How many attempts should be allowed?

Only a few, typically 3 to 5, after which the code is invalidated and a new one has to be requested. The TopSMS Verify API allows 5 attempts per code.

### How often may a user request a new code?

With a short pause and an hourly cap. The TopSMS Verify API allows another code to the same number after 30 seconds and at most 5 codes per hour; a new code invalidates the previous one.

### What does sending a verification code cost?

With TopSMS €0.089 per SMS to Germany, Austria and the rest of the EU zone, as a final price. Only the sent message is charged; checking the code is free, and with a test API key nothing is sent or charged.

## Related pages

- [Verify API: one-time codes without your own storage](https://topsms.eu/use-cases/otp-verification)
- [API documentation: Verify API](https://topsms.eu/docs#verify-api)
- [OTP via SMS: implementation and SMS vs app vs passkey](https://topsms.eu/blog/otp-sms-implementation)
- [Pricing per SMS](https://topsms.eu/pricing)
- [How many SMS are not delivered, and why](https://topsms.eu/blog/how-many-sms-are-not-delivered)

## Sources

- [NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management](https://pages.nist.gov/800-63-4/sp800-63b.html) (checked 2026-11-17)
