Skip to content

malkasun/sl-nic-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sl-nic-decoder

A smart Sri Lankan NIC decoding tool powered by Google Apps Script

🇱🇰 SL NIC Decoder (Sri Lanka)

Project Status License Powered By

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)


✨ Features

  • 🔄 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.

🧠 How It Works (The Logic)

This project uses a custom algorithm to reverse-engineer the NIC number logic used by the Department of Registration of Persons (Sri Lanka).

1. The 500 Rule (Gender)

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; }

2. The Leap Year Standard

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.

3. Old vs New Format

  • Old Format: The first two digits represent the year (19xx).
  • New Format: The first four digits represent the full year.

🛠️ Tech Stack

  • Frontend: HTML5, CSS3, Bootstrap 5 (for Glassmorphism UI)
  • Backend: Google Apps Script (.gs)
  • Deployment: Google Web App Service

🚀 How to Run Your Own Copy

  1. Go to script.google.com.
  2. Create a new project.
  3. Copy the contents of Code.js into Code.gs.
  4. Create an index.html file and copy the HTML code.
  5. Click Deploy > New Deployment > Web App.
  6. Set "Who has access" to "Anyone".

👨‍💻 Author

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.

About

A smart Sri Lankan NIC decoding tool powered by Google Apps Script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published