User Rating 0.0
Total Usage 0 times
Is this tool helpful?

Your feedback helps us improve.

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.

south african id sa id generator luhn algorithm fake id number id validator south africa identity number

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 d1d2d12:

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 = 12i=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:

{
Female if 0000 SSSS 4999Male if 5000 SSSS 9999

Reference Data

PositionDigitsFieldDescriptionValid Range
1 - 2YYYear of BirthLast two digits of birth year00 - 99
3 - 4MMMonth of BirthCalendar month01 - 12
5 - 6DDDay of BirthCalendar day (validated per month)01 - 31
7 - 10SSSSGender SequenceFemale: 0000 - 4999, Male: 5000 - 99990000 - 9999
11CCitizenship0 = SA Citizen, 1 = Permanent Resident0 or 1
12ADeprecatedPreviously race classifier, now fixed8 (legacy: 0 - 9)
13ZChecksumLuhn Mod-10 check digit0 - 9
Common Validation Failures
Error TypeCauseExample
Invalid DateMonth 13 or Day 329513326633088
Leap YearFeb 29 on non-leap year9902296633088
Checksum FailLuhn digit mismatch9701286633087
CitizenshipDigit 11 not 0 or 19701286633085
Leap Year Rules
RuleDescription
Divisible by 4Year is a leap year candidate
Divisible by 100Not a leap year (exception below)
Divisible by 400Is a leap year (overrides above)
Days Per Month Reference
MonthDaysNotes
Jan, Mar, May, Jul, Aug, Oct, Dec31 -
Apr, Jun, Sep, Nov30 -
Feb28 or 2929 only in leap years

Frequently Asked Questions

The Luhn algorithm detects all single-digit transcription errors and most transposition errors of adjacent digits. When you swap two consecutive digits, the doubled-digit sum changes, causing the total modulo 10 to become non-zero. This catches approximately 98% of random errors in a 13-digit string. However, it cannot detect transpositions of 09 ↔ 90 because both produce identical Luhn contributions.
The SA ID uses only two digits for the year. This tool uses the current date as a reference: if the two-digit year is less than or equal to the current two-digit year plus 1 (e.g., 25 in 2024), it maps to the 2000s. Otherwise, it maps to the 1900s. For example, 24 → 2024, 97 → 1997. When generating by age, the tool computes the exact birth year and extracts the last two digits, avoiding ambiguity entirely.
Yes. The SA ID number space contains approximately 366 × 10,000 × 2 × 10 × 1 = 73,200,000 structurally valid combinations per century. With roughly 60 million South Africans holding IDs, collisions are statistically probable. Generated IDs are for software testing, form validation development, and educational purposes only. Using them for identity fraud is a criminal offense under the South African Identification Act (No. 68 of 1997).
Digit 12 was historically designated as a race classifier under apartheid-era legislation (0 for White, etc.). Post-1994, the field was deprecated and is conventionally set to 8 in modern issuances. Some legacy IDs may have other values. This generator defaults to 8 but the validator accepts any digit in position 12, as the Luhn checksum already accounts for it.
The validator checks the embedded date against full Gregorian leap year rules: divisible by 4 AND (not divisible by 100 OR divisible by 400). An ID containing 990229 fails because 1999 is not a leap year. The ID 000229 passes because 2000 is divisible by 400. Even if the Luhn checksum is correct, an invalid calendar date causes the ID to fail validation.
Yes. The citizenship digit (position 11) is included in the Luhn sum calculation. Changing it from 0 to 1 alters the checksum. The generator computes Luhn after setting all 12 digits including citizenship, so both citizen and permanent resident IDs are checksummed correctly. Any value other than 0 or 1 at position 11 is structurally invalid per the specification, though Luhn alone would not flag it.