Everyday math · Phones & documents
How is the last digit of a Thai ID number worked out?
Short answer: digit 13 isn’t random. It is computed from the first 12 digits using “the remainder after dividing by 11” (mod 11), to catch typos. If 1 digit is mistyped, the result usually no longer matches the last digit, so a system can tell right away that the number is probably wrong.
What the 13 digits tell you
Digit 1 gives the type of person, followed by the area code where the person was registered and the sequence number in the register. The last digit (digit 13) is a check digit computed from the first 12
How digit 13 is computed (the commonly used formula)
- Multiply the first 12 digits by 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 in that order
- Add up all the products
- Divide by 11 and look at the remainder (call it r)
- Compute 11 − r · if that has 2 digits, use the ones digit ⇒ that is digit 13
Example (made-up number 1-1223-34455-66)
Wide table ⇒ swipe left and right to see all 12 digits
| Digit | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 | 5 | 6 | 6 |
| × weight | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 |
| = product | 13 | 12 | 22 | 20 | 27 | 24 | 28 | 24 | 25 | 20 | 18 | 12 |
Sum = 245 · 245 ÷ 11 = 22 remainder 3 · 11 − 3 = 8 ⇒ digit 13 = 8
So the full number is 1-1223-34455-66-8 (still a made-up number)
Try it
Type 12 digits to see what digit 13 should be, or 13 digits to check · use made-up numbers only (everything runs on your device; nothing is sent anywhere)
How many typos does it catch?
- 1 wrong digit: for most positions about 98.2% or more are caught · a typo in digit 13 itself is caught 100.0% of the time
- But digit 3 is never caught (0.0%), because its weight is 11 · e.g. change 2 to 7 and the sum rises by 11 × 5 = 55, which divides by 11 exactly, so the remainder and digit 13 stay the same (try typing 1172334455668 in the box above: it passes!)
- One more small gap: remainders 0 and 10 both give digit 13 = 1 (11 − 0 = 11, ones digit 1 · 11 − 10 = 1), so a few typos slip through
- Swapping 2 neighboring digits (e.g. 23 to 32): about 96.0–98.2% caught, depending on the position
Counted exactly over every 12-digit number whose first digit is 1–8 (800,000,000,000 numbers) · compare the old book number ISBN-10, which also uses mod 11 but writes “X” for 10 and has no weight of 11, so it catches every 1-digit typo and every neighbor swap
The math behind it
- Directly: remainders (modular arithmetic) and a weighted sum (weighted sum)
- Why 11? Because 11 is a prime (prime) · if the weight is not a multiple of 11 and the digit changes by at most 9, the change in the sum never divides by 11 ⇒ the remainder always changes · the few misses come from remainders 0 and 10 giving the same digit, and from digit 3, whose weight is exactly 11
- Behind the scenes: the “check digit” idea is used in book numbers (ISBN) and other codes people type by hand
Good to know
- Digit 13 is not a secret code; anyone can compute it. It catches typos; it doesn’t say whether the number belongs to a real person
- Never type or post a real ID number in public · made-up numbers show the whole idea
References
- Wikipedia (in Thai): Thai personal identification number
- Krungthep Turakij (in Thai): what the 13 digits on an ID card tell you
- python-stdnum: stdnum/th/pin.py (code that checks Thai ID numbers)
- Wikipedia: ISBN (ISBN-10 check digits)
Accessed 12 Nov 2026 · the numbers on this page were computed from the formula ourselves