Creation of Singapore Identity Number — NRIC

Some of you have tried out the NRIC number generator which I have created. If you have not, it is in this site.

NRIC Validator / Generator

Introduction

Majority of countries have their own unique identity card. In a Wikpedia article , more than 100 countries issued their own identity card to their citizens as compulsory.

Singapore is no exception. Every citizens and permanent residents are issued an identity card that is called National Registration Identity Card (NRIC). Every NRIC have a unique number.

NRIC generator sites are not unique. Do a google search and you will find several results that shows sites that generate NRIC number.

This pet project is a weekend fun project. It started off as a curiosity how the number has been generated. As part of testing, sometimes, we need to “mock” several other data points , such as name, address etc. NRIC or other numbers can be one of the many data inputs if it is part of the project requirements.

How are these numbers generated ? This article will discuss about the generation of NRIC numbers.

Importance of Mocking Data

As a requirement for testing, it is important to mock (or fake) input datas. Mocking is a form of creating fake data. We can have mock (or fake) data such as name, credit card numbers , address. They are not real — they are used for purposes of testing and development. One reason for mocking of data is that we can generate hundreds of different records so that we can test it in the automation, and the test scenario can widen. NRIC numbers generation is used for mocking too. As such, it is important to mock up a user data without using any real ones for testing and development. As an engineering team, the ability to generate huge input data is crucial.

History of NRIC

In 1966, the National Registration Act was enacted. This required all citizens and permanent residents to register or re-register for their ICs.

Compared to the paper ICs previously issued, ICs from this period were laminated. They were also colour-coded — Singapore Citizens were issued pink cards while Permanent Residents were issued blue cards.

This version’s biggest improvement was its enhanced security feature. To guard against forgery, the ICs had unique identification numbers for every individual that would be retained for subsequent IC replacements.

Special NRIC for Special People

These unique NRIC numbers apply to the very pioneer politicians. They are

  • S0000001I (Yusof bin Ishak, first President of Singapore)
  • S0000002G (Wee Chong Jin, first Chief Justice of Singapore)
  • S0000003E (Lee Kuan Yew, first Prime Minister of Singapore)
  • S0000004C (Kwa Geok Choo, wife of Lee Kuan Yew)
  • S0000005A (Toh Chin Chye, first Deputy Prime Minister of Singapore)
  • S0000006Z (Goh Keng Swee, second Deputy Prime Minister of Singapore)
  • S0000007H (S Rajaratnam, first Minister for Culture)

Caveats

  • The algorithm for computing the check digit for Singapore identity card numbers is unpublished.
  • Algorithm is partially described in various open sources. They have been tested and trial by many open sources. If you want to know how they generated, you may enquire ICA. There is a charge of license fees for Singapore companies that need to verify UIN / FIN by ICA.
  • This does not mean that the algorithm discuss in this article is the same as what the government issued. It is likely that there is variants and differences from this article and its below references. Take this article as guideline, but this is not an absolute truth on the algorithm.
  • The information does not mean that you can use it for illegal or malicious purposes. Don’t be naive thinking that getting a NRIC number means that you can do illegal activities. Generating a identity number for illegal activities will not get anyone far. There are checks and verification. Even if there are no verification, it is easy for commercial entities to check the authenticity of the NRIC through various means.
  • Legality of this discussion on algorithm — Source code can be copyright code, but not algorithm. This is crucial caveat why we are discussing algorithm. It is different from source code. Neither is this covered under patent as this is more than 20 years (the expiry of patent). The algorithm is already well known in public domain (such as google search result mention above) hence it is not under Trade Secret. The National Registration Act does not prohibit the discussion of algorithm.
  • If you want to know if the NRIC number is genuine and not issued, you can go to Singpass to find out yourself. A generated NRIC number is not the same as a Singapore Government issued NRIC number. Don’t make a mockery by attempting to use a generated number for illicit activities as these can be easily discovered.

Algorithm explanation

Prefix

S, T — 19th and 20th letters of alphabet for Singaporeans issued in year 19xx and 20xx.

F, G — Alphabets for foreigners issued in year 19xx and 20xx

Check Digit

Compute from first 8 characters (7 numbers and prefix) and it is used to check for any error.

Numbers

For Singapore citizens and permanent residents born in 1968 and after, their NRIC number will start with their year of birth e.g. 71xxxxx#. For those born in 1967 and earlier, the NRIC number does not relate to year of birth, and commonly begins with 0 or 1. Non-native Singaporeans who were born before 1965 are assigned the heading numbers 2 or 3 upon conversion of permanent residency (PR) or citizenship.

Steps to calculate NRIC number

The steps involved in the computation are as follows:

  1. Multiply each digit in the NRIC number by its weight i.e. 2 7 6 5 4 3 2 in order.
  2. Add together the above products.
  3. If the first letter i.e. UIN of the NRIC starts with T or G, add 4 to the total.
  4. Find the remainder of (sum calculated above) mod 11.
  5. If the NRIC starts with F or G: 0=X, 1=W, 2=U, 3=T, 4=R, 5=Q, 6=P, 7=N, 8=M, 9=L, 10=K
  6. If the NRIC starts with S or T: 0=J, 1=Z, 2=I, 3=H, 4=G, 5=F, 6=E, 7=D, 8=C, 9=B, 10=A

Example

The math goes like this:

1) Take for example the NRIC number S1234567. The first digit you multiply by 2, second multiply by 7, third by 6, fourth by 5, fifth by 4, sixth by 3, seventh by 2. Then you add the totals together. So,1×2+2×7+3×6+4×5+5×4+6×3+7×2=106.

2) If the first letter of the NRIC starts with T or G, add 4 to the total.

3) Then you divide the number by 11 and get the remainder. 106/11=9r7 (9 remainder 7)

4) You can get the alphabet depending on the NRIC type (the first letter in the NRIC) using the code below:

If the NRIC starts with S or T: 0=J, 1=Z, 2=I, 3=H, 4=G, 5=F, 6=E, 7=D, 8=C, 9=B, 10=A

If the NRIC starts with F or G: 0=X, 1=W, 2=U, 3=T, 4=R, 5=Q, 6=P, 7=N, 8=M, 9=L, 10=K

Does that mean my NRIC number is not unique ?

No, it is unique. Under the PDPC advisory guidelines (2020) , NRIC holders should not be giving out their own NRIC number to commercial entities when there are alternative (like using mobile phone instead). In the event if you do need to disclose full NRIC number for verification purposes, you may consider masking part of NRIC number, leaving the last few digits as practised by commercial entities. However, you should also not treat any given NRIC number (or any ID number) as real, as they may be generated. Verify with other sources.

You will not be able to generate a genuine NRIC as this is only issued by the Singapore Government. However, if someone try to bluff their way through by giving you a seemingly NRIC look alike number, you can do a quick calculation and see if it validate according to this algorithm.

Hopefully, this article should explain how your (or your Singaporean / PR friends) NRIC numbers are generated.

I like to express my thanks and credit to the references below — without them, these article and the NRIC generator would not be possible.

References

https://demi-aaron-1206.blogspot.com/2011/08/all-about-nric-number-in-singapore.html

https://forum.singaporeexpats.com/viewtopic.php?t=85477

http://www.ngiam.net/NRIC/NRIC_numbers.pdf

https://samliew.com/singapore-nric-validator

https://goodyfeed.com/6-facts-about-spore-nric-number-that-sporeans-should-know-about/

https://mothership.sg/2017/08/heres-the-story-of-spores-nric-because-its-often-taken-for-granted-unless-youre-serving-ns/

https://www.singpass.gov.sg/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store