A smart Sri Lankan NIC decoding tool powered by Google Apps Script
A smart, lightweight web application to decode Sri Lankan National Identity Card (NIC) numbers. This tool supports both the Old (9-digit) and New (12-digit) formats, extracting vital information like Birthday, Gender, and Age instantly.
(Click the link above to test the app)
- 🔄 Auto Detection: Automatically identifies Old (19xxxxxxxV) vs New (200xxxxxxxxx) NIC formats.
- 📅 Birthday Calculation: Extracts the exact date of birth.
- 🚻 Gender Logic: Determines gender based on the day count value (Days > 500 = Female).
- ⏳ Age Calculator: Shows the current age accurately.
- 🎲 Lucky Number: A fun feature calculating a numerology number based on the birthday digits.
- 📱 Responsive UI: Built with Bootstrap 5 to look great on Mobile and PC.
This project uses a custom algorithm to reverse-engineer the NIC number logic used by the Department of Registration of Persons (Sri Lanka).
In the SL NIC system, the day-of-year value represents the gender:
- Male: Days 1 - 366
- Female: Days 501 - 866
The code checks
if (days > 500) { Gender = Female; Days = Days - 500; }
Since the NIC department utilizes a static calendar assumption (assuming February always has 29 days for indexing), the algorithm uses a Leap Year Reference (2024) to map the day count back to the exact Month and Date. This ensures accuracy for all birth years.
- Old Format: The first two digits represent the year (19xx).
- New Format: The first four digits represent the full year.
- Frontend: HTML5, CSS3, Bootstrap 5 (for Glassmorphism UI)
- Backend: Google Apps Script (.gs)
- Deployment: Google Web App Service
- Go to script.google.com.
- Create a new project.
- Copy the contents of
Code.jsintoCode.gs. - Create an
index.htmlfile and copy the HTML code. - Click Deploy > New Deployment > Web App.
- Set "Who has access" to "Anyone".
Developed by Kasun Charitha. Building smart solutions for everyday problems.
Disclaimer: This tool is for educational and utility purposes only. It decodes data embedded in the public NIC number format and does not access any government database.