stdnum.be.nn

NN, NISS, RRN (Belgian national number).

The national registration number (Rijksregisternummer, Numéro de registre national, Nationalregisternummer) is a unique identification number of natural persons who are registered in Belgium.

The number consists of 11 digits and includes the person’s date of birth and gender. It encodes the date of birth in the first 6 digits in the format YYMMDD. The following 3 digits represent a counter of people born on the same date, seperated by sex (odd for male and even for females respectively). The final 2 digits form a check number based on the 9 preceding digits.

Special cases include:

  • Counter exhaustion: When the even or uneven day counter range for a specific date of birth runs out, (e.g. from 001 tot 997 for males), the first 2 digits will represent the birth year as normal, while the next 4 digits (birth month and day) are taken to be zeroes. The remaining 3 digits still represent a day counter which will then restart. When those ranges would run out also, the sixth digit is incremented with 1 and the day counter will restart again.

  • Incomplete date of birth When the exact month or day of the birth date were not known at the time of assignment, incomplete parts are taken to be zeroes, similarly as with counter exhaustion. Note that a month with zeroes can thus both mean the date of birth was not exactly known, or the person was born on a day were at least 500 persons of the same gender got a number assigned already.

  • Unknown date of birth When no part of the date of birth was known, a fictitious date is used depending on the century (i.e. 1900/00/01 or 2000/00/01).

More information:

>>> compact('85.07.30-033 28')
'85073003328'
>>> validate('85 07 30 033 28')
'85073003328'
>>> validate('17 07 30 033 84')
'17073003384'
>>> validate('12345678901')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('85073003328')
'85.07.30-033.28'
>>> get_birth_date('85.07.30-033 28')
datetime.date(1985, 7, 30)
>>> get_birth_year('85.07.30-033 28')
1985
>>> get_birth_month('85.07.30-033 28')
7
>>> get_gender('85.07.30-033 28')
'M'
stdnum.be.nn.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.be.nn.format(number)

Reformat the number to the standard presentation format.

stdnum.be.nn.get_birth_date(number)

Return the date of birth.

stdnum.be.nn.get_birth_month(number)

Return the month of the birth date.

stdnum.be.nn.get_birth_year(number)

Return the year of the birth date.

stdnum.be.nn.get_gender(number)

Get the person’s gender (‘M’ or ‘F’).

stdnum.be.nn.is_valid(number)

Check if the number is a valid National Number.

stdnum.be.nn.validate(number)

Check if the number is a valid National Number.