National Identification Number - South Africa - Validation

Validation

A South African person identification number is a 13-digit number containing only numeric characters, and no whitespace, punctuation, or alpha characters. It is defined as YYMMDDSSSSCAZ:

  • YYMMDD represents the date of birth (DoB);
  • SSSS is a sequence number registered with the same birth date (where females are assigned sequential numbers in the range 0000 to 4999 and males from 5000 to 9999);
  • C is the citizenship with 0 if the person is a SA citizen, 1 if the person is a permanent resident;
  • A is 8 or 9. Prior to 1994 this number was the used to indicate the holder's race;
  • Z is a checksum digit.

Using ID Number 8001015009087 as an example, it would read as follows:

The ID indicates that a male citizen was born on 1 January 1980; he was the 10th person to be registered (assuming that the first male to be registered on that day would be assigned the sequence number 5000).

The checksum digit is calculated using the Luhn algorithm:

  • A = The sum of the digits in the ID number in the odd positions (Excluding Z)
  • B = The number formed by the concatenation of the digits in the ID number in the even positions
  • C = The sum of the digits in (2 * B)
  • D = A + C
  • Z = 10 - (D mod 10)

Read more about this topic:  National Identification Number, South Africa