Skip to content

minmyatoo/malaysia-tin-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Malaysia TIN Validator

alt text

A comprehensive web-based tool for validating Malaysian Tax Identification Numbers (TIN) and National Registration Identity Card (NIRC) numbers. This validator supports all official TIN formats and provides extensive features for individual and bulk validation.

Features

Core Validation

  • Individual TINs - New version (IG + 10 digits) and Old version (SG/OG + 9 digits)
  • Non-Individual TINs - New version (C/D/E/F + 10 digits) and Old version (C/D/E/F + 9 digits)
  • General TINs - Predefined special-purpose TINs (EI00000000010, etc.)
  • Pattern Validation - Verifies correct format and digit composition
  • Input Sanitization - Automatically cleans and normalizes input

User Features

  • 🎲 Random TIN Generation - Generate valid sample TINs for testing
  • 📋 Bulk Validation - Validate up to 100 TINs simultaneously
  • 📊 Real-time Statistics - Track validation success/failure rates
  • 📝 Validation History - Maintains last 10 validations with timestamps
  • 💾 Persistent Storage - History saved across browser sessions
  • 📤 CSV Export - Export validation history with timestamps
  • 📋 Clipboard Support - Modern clipboard API with fallback

Security & Quality

  • 🔒 Input Sanitization - Prevents injection attacks
  • 🛡️ XSS Protection - All outputs properly escaped
  • Accessibility - WCAG compliant with ARIA labels
  • 📱 Responsive Design - Works on all device sizes
  • 🎨 User-Friendly UI - Bootstrap 5 with smooth animations

Usage

Basic Validation

  1. Open index.html in a web browser
  2. Enter a TIN or NIRC number in the input field
  3. Click "Validate" or press Enter to check validity
  4. View detailed information about the TIN type and category

Bulk Validation

  1. Click "Bulk Validation" to expand the section
  2. Enter one TIN per line in the textarea
  3. Click "Validate All" to process all TINs
  4. View summary and individual results

History Management

  • View recent validations in the History section
  • Click "Export History" to download as CSV
  • Click "Clear History" to reset all data
  • History automatically persists across sessions

TIN Format Reference

Type Format Length Example
Individual (New) IG + 10 digits 12 IG1234567890
Individual (Old) SG/OG + 9 digits 11 SG123456789
Non-Individual (New) C/D/E/F + 10 digits 11 C1234567890
Non-Individual (Old) C/D/E/F + 9 digits 10 C123456789
General EI + 10 digits 13 EI00000000010

Technical Details

Architecture

  • Frontend: Pure HTML5, CSS3, JavaScript (ES6+)
  • UI Framework: Bootstrap 5.3.0
  • Icons: Font Awesome 6.4.0
  • Storage: LocalStorage API for persistence
  • No Backend Required: Fully client-side validation

Browser Compatibility

  • ✅ Chrome/Edge 90+
  • ✅ Firefox 88+
  • ✅ Safari 14+
  • ✅ Opera 76+

Key Technologies

  • Modern JavaScript: ES6+ features (arrow functions, template literals, async/await)
  • Clipboard API: Modern navigator.clipboard with legacy fallback
  • LocalStorage: Persistent data storage with error handling
  • Accessibility: ARIA labels, roles, and live regions
  • Responsive Design: Mobile-first approach with Bootstrap grid

Code Quality

  • JSDoc Comments: Full documentation for all functions
  • Input Validation: Comprehensive sanitization and checks
  • Error Handling: Try-catch blocks with user feedback
  • Performance: Optimized DOM operations
  • Security: XSS prevention and input sanitization

Testing

Comprehensive test cases are available in TEST_CASES.md, including:

  • Valid and invalid TIN examples for all formats
  • Edge cases and boundary conditions
  • Bulk validation scenarios
  • Security and accessibility tests
  • Performance benchmarks

Development

Project Structure

malaysia-tin-validator/
├── index.html          # Main HTML file
├── script.js           # JavaScript validation logic
├── style.css           # Custom styles
├── README.md           # This file
├── TEST_CASES.md       # Comprehensive test cases
└── tin_validator.png   # Screenshot

Local Development

  1. Clone the repository
  2. Open index.html in your browser
  3. No build process or dependencies required
  4. Test changes immediately

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with proper documentation
  4. Test thoroughly using TEST_CASES.md
  5. Submit a Pull Request

Changelog

Version 2.0.0 (2025)

  • ✨ Added comprehensive input sanitization
  • ✨ Implemented localStorage for persistent history
  • ✨ Enhanced accessibility with ARIA labels
  • ✨ Improved error handling and user feedback
  • ✨ Added bulk validation with summary results
  • ✨ Modern Clipboard API with fallback
  • ✨ Complete JSDoc documentation
  • ✨ XSS protection for all outputs
  • 🐛 Fixed CSS file reference bug
  • 📚 Added comprehensive test cases

Version 1.0.0 (2024)

  • 🎉 Initial release
  • Basic TIN validation for all formats
  • Random TIN generation
  • Simple validation history
  • CSV export functionality

Credits

Developer: Min Myat Oo Email: [email protected] Version: 2.0.0 Last Updated: November 2025

License

This project is open source and available under the MIT License.

Support

For bug reports, feature requests, or questions, please open an issue in the repository.


Note: This validator checks format compliance only. For official TIN verification, please consult the Malaysian Inland Revenue Board (LHDN).

About

Web-based Malaysia TIN Validator: Easily validate Malaysian Tax Identification Numbers and NIRC.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •