Skip to main content

French social security number key calculator (NIR)

Calculate the control key of a French social security number (NIR) from its first 13 characters, Corsica included, or check a 15-character number, without sending anything to a server.

  • France

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Sex, year, month, place of birth and order number, without the key. Spaces and dots are accepted.

A correct key only proves that the number is consistent, not that it was issued or to whom. The calculation runs in your browser: the number is not stored, sent or tracked.

Was this tool useful?

How does this tool work?

The French social security number, officially called NIR (numéro d’inscription au répertoire), has 13 characters followed by a 2-digit control key. The key is not a second number: it is calculated from the first 13 characters to catch typing errors. This tool calculates a missing key or checks a complete 15-character number with the method published by INSEE, the French statistics institute, including people born in Corsica (2A, 2B), in the overseas departments or outside France.

The first 13 characters are read as one number: sex (1 digit), year of birth (2), month (2), place of birth (5) and order number (3). Spaces, dots and hyphens are ignored.

For a Corsican department, INSEE replaces the letter with 0 and then subtracts 1,000,000 for 2A or 2,000,000 for 2B, which amounts to calculating with 19 instead of 2A and 18 instead of 2B.

The resulting number is divided by 97. The key is the complement to 97 of the remainder: 97 minus the remainder, written on two digits (01 to 97).

In check mode, the tool recalculates the key of the first 13 characters and compares it with the last two digits entered. If they differ, it shows the expected key.

How to use this tool

  1. Choose the action

    Calculate the key from 13 characters, or check a complete 15-character number.

  2. Enter the number

    Type it with or without spaces, keeping 2A or 2B for a Corsican department.

  3. Read the result

    The tool shows the formatted number and its key, then the sex, month and year of birth and place of birth encoded in it.

NIR control key

French social security number key

key = 97 − (N mod 97), where N is the number formed by the first 13 characters (2A → 19, 2B → 18)

N
13-digit number formed by sex, year, month, place of birth and order number; for Corsica, 2A becomes 19 and 2B becomes 18
N mod 97
remainder of the integer division of N by 97 (0 to 96)

Written on two digits, the key ranges from 01 to 97. The check catches any single-digit error and any swap of two adjacent digits.

Use cases

Check payroll or HR data

Spot a typo in an employee’s French social security number before saving it in payroll software or a declaration.

Recover an unreadable key

When the last two digits are blurred on a copy of a Carte Vitale or certificate, the key can be recalculated from the first 13 characters.

Test a form or software

Make sure your own input validation handles Corsica and births abroad correctly, using fictitious numbers.

Examples

Calculate the key of a fictitious number

1841276451089 divided by 97 leaves a remainder of 51, so the key is 97 − 51 = 46. The number describes a man born in December 1984 in department 76.

Input

First 13 characters of the number: 1 84 12 76 451 089

Result

Key calculated: 46; complete number: 1 84 12 76 451 089 46

Number of a person born in Corsica

The calculation uses 1751219345678, where 2A is replaced by 19 as the INSEE method requires.

Input

First 13 characters of the number: 1 75 12 2A 345 678

Result

Key calculated: 58

Detect a wrong key

Swapping the two digits of the key is enough to make the number inconsistent.

Input

Complete social security number: 1 84 12 76 451 089 64

Result

Wrong key: the expected key is 46.

Tips and best practices

  • Copy the number from an official document (Carte Vitale, health insurance certificate, payslip) rather than relying on a recalculated key.
  • Do not replace 2A or 2B with 20: the result would be wrong for everyone born in Corsica.
  • A number starting with a digit other than 1 or 2 is not a permanent NIR.
  • Use fictitious numbers for testing: a real number is personal data that must be protected.

Sources and references

Frequently asked questions

How is the key of a French social security number calculated?

Divide the first 13 digits by 97 and keep the remainder. The key is 97 minus that remainder, on two digits. For example, 1841276451089 leaves a remainder of 51, so the key is 46.

What about numbers containing 2A or 2B?

INSEE replaces the letter with 0 and subtracts 1,000,000 for 2A and 2,000,000 for 2B. In practice, you calculate with 19 instead of 2A and 18 instead of 2B. The tool does this automatically.

Does a correct key prove that the number exists?

No. The key catches common typing errors, but an invented number can have a correct key. Only authorised bodies can confirm that a number was issued to a person.

Does the key use the Luhn algorithm?

No. The NIR uses a modulo 97 check. The Luhn algorithm is used by other identifiers, such as the SIREN number of French companies or bank card numbers.

Is my number sent anywhere?

No. The calculation runs in your browser: the number is not stored, transmitted or recorded by our analytics. In France, the use of the NIR is strictly regulated, as the CNIL points out.

Why is the month of birth shown as “not recorded”?

When the month of birth is unknown, INSEE uses special codes instead of 01 to 12. The key is calculated in the same way.

Related tools

Tools similar or complementary to this one.

Similar tools

Build a French intra-community VAT number from a SIREN or SIRET, or check its key.

Finance & businessFranceNewUse this tool