South African ID Generator
Generate valid or invalid fake South African ID numbers with Luhn checksum. Validate existing SA IDs. Decode gender, DOB, and citizenship.
About
A South African Identity Number is a 13-digit numeric string encoding date of birth, gender sequence, citizenship status, and a Luhn checksum digit. Incorrect generation or validation of these numbers causes failures in testing pipelines, form validation logic, and compliance audits. This tool implements the full SA ID specification: the first 6 digits encode YYMMDD, digits 7-10 form a gender sequence SSSS where 0000 - 4999 designates female and 5000 - 9999 designates male, digit 11 is citizenship (0 = SA citizen, 1 = permanent resident), digit 12 is historically deprecated (fixed at 8), and digit 13 is the Luhn Mod-10 check digit. The generator computes mathematically valid IDs. The validator reverse-parses and verifies all structural constraints including calendar-valid dates and correct checksums.
Limitation: generated IDs are structurally valid but fictitious. They must not be used for identity fraud or any unlawful purpose. The tool assumes the post-2000 convention where years 00 - 24 map to 2000-2024 and 25 - 99 map to 1925-1999. Edge case: February 29 is only generated for verified leap years.
Formulas
The Luhn Algorithm (Mod-10) computes the check digit Z (position 13) from the first 12 digits of the SA ID number.
Given the first 12 digits d1d2…d12:
1. For each digit di at an odd position (i = 1, 3, 5, …), keep di unchanged.
2. For each digit di at an even position (i = 2, 4, 6, …), compute di′ = 2 × di. If di′ > 9, then di′ = di′ − 9.
3. Compute the total sum:
S = 12∑i=1 di (after transformation)
4. The check digit:
Z = (10 − (S mod 10)) mod 10
Where di is the digit at position i (1-indexed from left), S is the Luhn sum, and Z is the resulting check digit appended as digit 13. For a complete ID to be valid, computing Luhn over all 13 digits must yield a total S13 where S13 mod 10 = 0.
The gender sequence SSSS (digits 7-10) partitions into two ranges:
Reference Data
| Position | Digits | Field | Description | Valid Range |
|---|---|---|---|---|
| 1 - 2 | YY | Year of Birth | Last two digits of birth year | 00 - 99 |
| 3 - 4 | MM | Month of Birth | Calendar month | 01 - 12 |
| 5 - 6 | DD | Day of Birth | Calendar day (validated per month) | 01 - 31 |
| 7 - 10 | SSSS | Gender Sequence | Female: 0000 - 4999, Male: 5000 - 9999 | 0000 - 9999 |
| 11 | C | Citizenship | 0 = SA Citizen, 1 = Permanent Resident | 0 or 1 |
| 12 | A | Deprecated | Previously race classifier, now fixed | 8 (legacy: 0 - 9) |
| 13 | Z | Checksum | Luhn Mod-10 check digit | 0 - 9 |
| Common Validation Failures | ||||
| Error Type | Cause | Example | ||
| Invalid Date | Month 13 or Day 32 | 9513326633088 | ||
| Leap Year | Feb 29 on non-leap year | 9902296633088 | ||
| Checksum Fail | Luhn digit mismatch | 9701286633087 | ||
| Citizenship | Digit 11 not 0 or 1 | 9701286633085 | ||
| Leap Year Rules | ||||
| Rule | Description | |||
| Divisible by 4 | Year is a leap year candidate | |||
| Divisible by 100 | Not a leap year (exception below) | |||
| Divisible by 400 | Is a leap year (overrides above) | |||
| Days Per Month Reference | ||||
| Month | Days | Notes | ||
| Jan, Mar, May, Jul, Aug, Oct, Dec | 31 | - | ||
| Apr, Jun, Sep, Nov | 30 | - | ||
| Feb | 28 or 29 | 29 only in leap years | ||