phone number standards

Sent logo
Sent TeamMar 8, 2026 / phone number standards / Article

Sri Lanka Phone Number Validation: Complete Guide to +94 Format & Implementation

Learn how to validate Sri Lanka phone numbers (+94 country code) using E.164 format standards. Covers TRC regulations, mobile operator prefixes (Dialog, Mobitel, Hutch, Airtel), JavaScript validation code, and emergency numbers.

Sri Lanka Phone Number Validation: Complete Guide to +94 Format & Implementation

Validate Sri Lanka phone numbers (+94 country code) using E.164 format standards. This guide covers phone number validation patterns, TRC (Telecommunications Regulatory Commission) regulations, mobile operator prefixes for Dialog, Mobitel, Hutch, and Airtel, JavaScript validation code, area codes, and emergency number handling for Sri Lankan telecommunications applications.

Quick Reference

AttributeValue
CountrySri Lanka
Country Code+94
International Prefix00
Trunk Prefix0
Number Length10 digits (including trunk prefix)
Regulatory BodyTelecommunications Regulatory Commission (TRC)
TRC Websitehttp://www.trc.gov.lk

Sri Lanka Phone Number Format and Validation

Avoid these common validation pitfalls:

  • Accepting invalid prefixes like 060, 069, or 079 (valid mobile prefixes: 070–078)
  • Rejecting numbers with spaces, hyphens, or parentheses without sanitization (e.g., "077 123 4567" or "+94 (77) 123-4567")
  • Failing to handle international format without the plus sign (94771234567)
  • Forgetting to strip the trunk prefix 0 when converting to E.164 format
  • Blocking emergency numbers with standard validation rules

Sanitize input before validation:

javascript
function sanitizePhoneInput(input) {
  // Remove spaces, hyphens, parentheses, and other formatting
  return input.replace(/[\s\-\(\)\.]/g, '');
}

// Usage
const userInput = "+94 (77) 123-4567";
const sanitized = sanitizePhoneInput(userInput);
const isValid = validateSriLankanNumber(sanitized);

Sri Lanka phone number validation requires understanding the country's E.164-compliant numbering system. The TRC regulates all Sri Lanka phone numbers, which use the +94 country code and a 10-digit national format (including trunk prefix 0).

E.164 Format Structure for Sri Lanka Numbers

  • Country Code: +94
  • National Number: 10 digits (including trunk prefix 0 for domestic dialing)
  • International format: +94771234567
  • Domestic format: 0771234567

Identify Sri Lanka Number Types by Prefix

Mobile Numbers – Begin with 070–078 (10 digits total):

  • 070, 071: SLT Mobitel
  • 072, 078: Hutch
  • 074, 075, 076, 077: Dialog and Airtel

Landline Numbers – Format: 0XX Y ZZZZZZ

  • 0XX: 2-digit area code identifying geographic region
  • Y: Operator code (2 = SLT Mobitel copper/fiber, 3 = SLT Mobitel wireless LTE, 4 or 7 = Dialog wireless LTE)
  • ZZZZZZ: 6-digit subscriber number

Complete Sri Lanka area codes (source: TRC Numbering Plan):

Area CodeRegionDistrictArea CodeRegionDistrict
011ColomboColombo036AvissawellaColombo
021JaffnaJaffna023MannarMannar
024VavuniyaVavuniya025AnuradhapuraAnuradhapura
026TrincomaleeTrincomalee027PolonnaruwaPolonnaruwa
031NegomboGampaha032ChilawPuttalam
033GampahaGampaha034KalutaraKalutara
035KegalleKegalle037KurunegalaKurunegala
038PanaduraKalutara041MataraMatara
045RatnapuraRatnapura047HambantotaHambantota
051HattonNuwara Eliya052Nuwara EliyaNuwara Eliya
054NawalapitiyaKandy055Badulla/MonaragalaBadulla/Monaragala
057BandarawelaBadulla063AmparaAmpara
065BatticaloaBatticaloa066MataleMatale
067KalmunaiAmpara081KandyKandy
091GalleGalle

Short Codes – 3 or 4 digits for emergency and special services

Important: Mobile operator prefixes indicate original network assignment. With Mobile Number Portability (MNP), subscribers can switch operators while keeping their numbers.

Implement Validation with Regular Expressions

Store numbers in E.164 format (+94XXXXXXXXX) for consistency and international compatibility.

Pattern explanation:

  • \D/g removes all non-digit characters (spaces, hyphens, parentheses)
  • ^0[0-9]{9}$ matches exactly 10 digits starting with 0 (domestic format)
  • ^(?:\+?94)[0-9]{9}$ matches country code 94 (with optional +) followed by 9 digits
  • The ?: makes the group non-capturing for better performance

Validate user input with regular expressions:

javascript
function validateSriLankanNumber(number) {
  // Remove all non-numeric characters
  const cleaned = number.replace(/\D/g, '');

  // Check for valid format: domestic (10 digits) or international (+94 followed by 9 digits)
  // Domestic format: 0XXXXXXXXX (10 digits starting with 0)
  // International format: 94XXXXXXXXX or +94XXXXXXXXX
  const domesticPattern = /^0[0-9]{9}$/;
  const internationalPattern = /^(?:\+?94)[0-9]{9}$/;

  return domesticPattern.test(cleaned) || internationalPattern.test(cleaned);
}

Validate mobile-only numbers (rejects invalid prefixes like 060, 079):

javascript
function validateSriLankanMobile(number) {
  const cleaned = number.replace(/\D/g, '');

  // Domestic format: must start with 070-078
  if (/^07[0-8][0-9]{7}$/.test(cleaned)) return true;

  // International format: +94 or 94 followed by 70-78
  if (/^(?:\+?94)7[0-8][0-9]{7}$/.test(cleaned)) return true;

  return false;
}

Identify number types based on prefix patterns:

javascript
function identifyNumberType(number) {
  const cleaned = number.replace(/\D/g, '');

  // Remove country code if present
  const national = cleaned.startsWith('94') ? cleaned.substring(2) : cleaned;

  // Remove trunk prefix if present for validation
  const withoutTrunk = national.startsWith('0') ? national.substring(1) : national;

  // Mobile numbers: 070-078 (originally 07X, now expanded to include 070-078)
  if (/^07[0-8][0-9]{7}$/.test(national)) return 'mobile';

  // Landline numbers: area codes 011-091 followed by 7 digits
  if (/^0[1-9][0-9][0-9]{7}$/.test(national)) return 'landline';

  // Emergency and special service numbers: 3-4 digits
  if (/^1[0-9]{2,3}$/.test(withoutTrunk)) return 'emergency/special';

  return 'invalid';
}

Mobile Number Portability (MNP)

MNP Status: As of 2025, Mobile Number Portability is not yet operational in Sri Lanka. The TRC announced in May 2025 that MNP implementation is underway, with service expected to launch in 2026 (TRC official announcement, SAMENA Council). Until MNP launches, mobile prefixes reliably indicate the current operator.

When MNP becomes available, subscribers will be able to switch operators while keeping their numbers. At that point, implement lookup mechanisms to determine the current operator.

MNP Lookup Services – Once MNP is operational, use third-party services for operator identification:

  • HLR (Home Location Register) Lookup: Queries the SS7 network to determine current operator, number status (active/inactive), and roaming state. Cost: $0.004–0.01 per query.
  • MNP-Only Lookup: Lower-cost alternative ($0.002–0.005 per query) that returns only the current operator without additional status data.
  • Popular providers: Infobip, Twilio, Plivo, Sinch, MessageBird, and specialized services like hlr-lookups.com

Integrate an MNP lookup service for accurate operator identification:

javascript
async function checkOperatorForNumber(phoneNumber) {
  try {
    // Example using a hypothetical MNP API
    // Replace with actual provider SDK or REST API
    const response = await fetch('https://api.mnp-provider.com/lookup', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ phone: phoneNumber })
    });

    const data = await response.json();
    return data.currentOperator; // Returns 'Dialog', 'Mobitel', 'Hutch', or 'Airtel'
  } catch (error) {
    console.error('MNP lookup failed:', error);
    // Fallback to prefix-based routing if lookup fails
    return getOperatorByPrefix(phoneNumber);
  }
}

function getOperatorByPrefix(phoneNumber) {
  const cleaned = phoneNumber.replace(/\D/g, '');
  const national = cleaned.startsWith('94') ? cleaned.substring(2) : cleaned;
  const prefix = national.substring(0, 3);

  const operatorMap = {
    '070': 'Mobitel', '071': 'Mobitel',
    '072': 'Hutch', '078': 'Hutch',
    '074': 'Dialog', '075': 'Dialog',
    '076': 'Dialog', '077': 'Dialog'
  };

  return operatorMap[prefix] || 'Unknown';
}

Route calls based on operator:

javascript
const routeCall = async (phoneNumber) => {
  const operator = await checkOperatorForNumber(phoneNumber);
  return getRoutingPath(operator);
};

function getRoutingPath(operator) {
  // Define routing configurations per operator
  const routes = {
    'Dialog': { gateway: 'dialog-gateway.example.com', priority: 1 },
    'Mobitel': { gateway: 'mobitel-gateway.example.com', priority: 1 },
    'Hutch': { gateway: 'hutch-gateway.example.com', priority: 1 },
    'Airtel': { gateway: 'dialog-gateway.example.com', priority: 2 } // Airtel uses Dialog network
  };

  return routes[operator] || routes['Dialog']; // Fallback to Dialog
}

MNP lookup considerations:

  • Cost: Budget $0.002–0.01 per lookup depending on service tier
  • Rate limits: Most providers allow 10–100 requests/second
  • Latency: Expect 200–800 ms response time for international HLR queries
  • Caching: Cache results for 24–48 hours to reduce costs (number portability takes 3–5 business days)
  • Fallback: Always implement prefix-based routing as backup when lookup fails

Emergency Numbers

All emergency numbers are toll-free and accessible from any phone, even with low signal or credit. Never apply prefixes, rate limiting, or validation restrictions to emergency numbers.

Primary Emergency Services:

  • 110 – Emergency and Rescue Services (regional offices)
  • 112 – Police Emergency Service (mobile-optimized)
  • 119 – Police Emergency Service
  • 1990 – Emergency Ambulance Service

Security and Defense:

  • 105 – Sri Lanka Navy maritime incident hotline
  • 106 – Sri Lanka Coast Guard (24-hour maritime distress hotline)
  • 113 – Sri Lanka Army Headquarters
  • 114 – Sri Lanka Army (national security and disaster relief)
  • 115 – Air Defence Command and Control Centre
  • 116 – Sri Lanka Air Force Air Defence Operation Centre

Specialized Support:

  • 101 – Cyber Security Emergency Coordination Centre
  • 107 – Police Emergency (Northern and Eastern Provinces, Tamil language)
  • 109 – Bureau for Prevention of Abuse of Children and Women
  • 117 – Disaster Management Call Centre
  • 118 – National Help Desk
  • 1919 – Information & Communication Technology Agency

Operator Customer Service:

  • 1212 – SLT Mobitel
  • 1755 – Airtel
  • 1777 – Dialog
  • 1788 – Hutch

All emergency services operate 24/7 with multi-language support (Sinhala, Tamil, English). Mobile operators prioritize emergency calls even during network congestion.

Source: TRC 3-Digit Short Codes for Special Services

Implement emergency detection:

javascript
const EMERGENCY_NUMBERS = [
  '110', '112', '119', '1990',  // Primary emergency
  '105', '106', '113', '114', '115', '116',  // Security/Defense
  '101', '107', '109', '117', '118', '1919'  // Specialized support
];

function isEmergencyNumber(number) {
  const cleaned = number.replace(/\D/g, '');
  return EMERGENCY_NUMBERS.includes(cleaned);
}

Network Considerations

Sri Lanka has mixed urban and rural network infrastructure. Dialog and Mobitel claim 95%+ 4G island-wide coverage. As of February 2025, Dialog and SLT Mobitel are conducting pre-commercial 5G trials but have not launched public 5G services (Opensignal Sri Lanka Report, Feb 2025). Design your application to handle varying connectivity.

Network quality by operator (2025):

  • Dialog: Best overall coverage and 4G availability in urban and rural areas
  • Mobitel: Strong nationwide coverage, 95% 4G availability, best for rural regions
  • Hutch: Good urban coverage, limited in remote areas
  • Airtel: Operates on Dialog's infrastructure after 2024 merger

Detect network quality and provide fallbacks:

javascript
function checkNetworkCapability() {
  const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
  if (connection) {
    return connection.effectiveType; // Returns '4g', '3g', '2g', or 'slow-2g'
  }
  return 'unknown';
}

// Browser compatibility: Chrome 61+, Edge 79+, Opera 48+
// Not supported in Firefox or Safari as of 2025

Implement coverage-aware features:

  • Cache validated phone numbers locally to avoid repeated API calls on poor connections
  • Implement request queuing for SMS/call operations when network is unstable
  • Provide offline validation using regex patterns (no external API needed)
  • Set timeout limits: 5 seconds for domestic API calls, 10 seconds for international MNP lookups

Compliance and Regulations

Follow TRC regulations and data protection laws for legal compliance:

Sri Lanka's Personal Data Protection Act (PDPA) No. 9 of 2022 regulates phone number collection and processing:

  • Consent: Obtain explicit consent before collecting phone numbers for marketing
  • Purpose limitation: Use phone numbers only for stated purposes
  • Data security: Implement encryption for stored phone numbers
  • Retention limits: Delete phone numbers when no longer needed
  • Data subject rights: Allow users to access, correct, and delete their phone numbers
  • Breach notification: Report data breaches to Data Protection Authority within 72 hours
  • Penalties: First violation up to 10 million LKR; subsequent violations up to 2x previous penalty

Note: Core PDPA provisions (Parts I-III, VII) had delayed implementation as of March 2025. Monitor Data Protection Authority website for enforcement updates.

SMS Marketing Consent:

  • Opt-in required: Obtain express written consent before sending marketing SMS
  • Opt-out mechanism: Include "Reply STOP to unsubscribe" in every marketing message
  • Record keeping: Maintain consent records with timestamp, method, and message content
  • No pre-checked boxes: Consent must be an explicit action by the user

TRC Telecommunications Regulations:

Compliance requirements by business type:

  • Enterprises (>100 employees): Appoint a Data Protection Officer under PDPA
  • SMS aggregators: Obtain a TRC telecommunications license
  • International services: Meet PDPA cross-border transfer requirements (adequacy determination or standard contractual clauses)

Error Handling

Provide clear, actionable error messages that explain what went wrong and how to fix it.

Implement error handling with clear, actionable messages:

javascript
function validateAndHandleErrors(phoneNumber) {
  try {
    if (!phoneNumber || phoneNumber.trim() === '') {
      throw new Error('Phone number is required. Enter a 10-digit Sri Lanka number.');
    }

    const result = validateSriLankanNumber(phoneNumber);
    if (!result) {
      throw new Error('Invalid phone number format. Use format: 0771234567 or +94771234567');
    }

    return result;
  } catch (error) {
    console.error('Validation error:', error);
    // Display user-friendly error message
    showErrorToUser(error.message);
    return null;
  }
}

function showErrorToUser(message) {
  // Example implementation - adapt to your UI framework
  const errorElement = document.getElementById('phone-error');
  if (errorElement) {
    errorElement.textContent = message;
    errorElement.style.display = 'block';
  }
}

Handle common scenarios:

javascript
// Scenario 1: Invalid format with helpful examples
function handleInvalidFormat(input) {
  const message = `Invalid format. Examples of valid formats:
    • Domestic: 0771234567
    • International: +94771234567
    • With spaces: +94 77 123 4567`;
  showErrorToUser(message);
}

// Scenario 2: MNP lookup failures with fallback
async function handleMNPLookupFailure(phoneNumber) {
  try {
    return await checkOperatorForNumber(phoneNumber);
  } catch (error) {
    console.warn('MNP lookup failed, using prefix-based routing');
    return getOperatorByPrefix(phoneNumber);
  }
}

// Scenario 3: Network issues with exponential backoff
async function retryWithBackoff(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
      await new Promise(resolve => setTimeout(resolve, delay));
    }
  }
}

// Scenario 4: Empty input with clear prompt
function handleEmptyInput() {
  const message = 'Please enter your Sri Lanka phone number (e.g., 0771234567)';
  showErrorToUser(message);
  document.getElementById('phone-input')?.focus();
}

Support internationalization (Sinhala/Tamil error messages):

javascript
const errorMessages = {
  en: 'Invalid phone number. Enter 10 digits starting with 07.',
  si: 'වලංගු නොවන දුරකථන අංකයකි. 07 න් ආරම්භ වන ඉලක්කම් 10ක් ඇතුළත් කරන්න.',
  ta: 'தவறான தொலைபேசி எண். 07 இல் தொடங்கும் 10 இலக்கங்களை உள்ளிடவும்.'
};

function showLocalizedError(language = 'en') {
  showErrorToUser(errorMessages[language] || errorMessages.en);
}

Frequently Asked Questions (FAQ)

What is the country code for Sri Lanka phone numbers?

Sri Lanka's country code is +94. When dialing from abroad, dial +94 followed by the 9-digit number (without the leading 0). For example, to call 0771234567 from outside Sri Lanka, dial +94771234567. Within Sri Lanka, dial the full 10-digit number including the leading 0.

How many digits are in a Sri Lanka phone number?

Sri Lanka phone numbers have 10 digits in the domestic format (including the trunk prefix 0). When using the international format with the country code (+94), the number is 9 digits (the 10-digit domestic number without the leading 0). Examples: domestic format 0771234567, international format +94771234567.

What is the format for Sri Lanka mobile numbers?

Sri Lanka mobile numbers are 10 digits starting with 07 (specifically 070-078). The format is 07X XXXXXXX where the first three digits identify the mobile operator:

  • SLT Mobitel: 070, 071
  • Hutch: 072, 078
  • Dialog and Airtel: 074, 075, 076, 077

All Sri Lankan mobile numbers begin with 07, followed by 8 additional digits. With Mobile Number Portability (MNP), these prefixes indicate the original network but not necessarily the current operator.

How do I validate a Sri Lanka phone number in JavaScript?

Use regular expressions to validate Sri Lanka phone numbers. Check for domestic format (10 digits starting with 0) or international format (+94 followed by 9 digits). Always sanitize input by removing spaces, hyphens, and parentheses before validation. See the JavaScript validation examples in this guide for production-ready code.

What are Sri Lanka landline area codes?

Sri Lanka landline area codes are 2-digit numbers that identify geographic regions:

  • 011: Colombo
  • 031: Negombo
  • 081: Kandy
  • 091: Galle
  • 041: Matara
  • 021: Jaffna
  • 026: Trincomalee

Landlines follow the format: 0XX Y ZZZZZZ (area code + operator code + 6-digit subscriber number). See the complete area code table for all regions.

What is the emergency number in Sri Lanka?

Sri Lanka has multiple emergency numbers:

  • 119: Police Emergency Service
  • 112: Police Emergency (mobile-optimized)
  • 110: Emergency and Rescue Services
  • 1990: Emergency Ambulance Service

All emergency numbers are toll-free and accessible even with low signal or credit. View the complete emergency numbers list for specialized services.

Does Sri Lanka support mobile number portability?

As of 2025, Mobile Number Portability (MNP) is not yet operational in Sri Lanka. The TRC announced that MNP is expected to launch in 2026. Until then, mobile number prefixes reliably indicate the operator (Dialog, Mobitel, Hutch, Airtel). Once MNP launches, use an MNP lookup service for accurate operator identification.

Who regulates Sri Lanka phone numbers?

The Telecommunications Regulatory Commission (TRC) regulates the country's phone numbering system and telecommunications services. The TRC ensures compliance with international E.164 standards and manages the national numbering plan. Visit http://www.trc.gov.lk for official regulations.

Additional Resources

Developer tools and libraries:

  • libphonenumber (Google): Comprehensive phone number parsing and validation library supporting Sri Lanka
  • International phone validation libraries: intl-tel-input (JavaScript), phonenumbers (Python), libphonenumber-js (lightweight JS)

Conclusion

Validating Sri Lanka phone numbers requires understanding E.164 format standards, TRC regulations, and the country's 10-digit numbering system with +94 country code. This guide provides production-ready validation patterns, operator identification methods, and regulatory compliance requirements.

Key takeaways:

  • Store numbers in E.164 international format (+94XXXXXXXXX)
  • Validate both domestic (10 digits with 0) and international formats (+94 + 9 digits)
  • Include all mobile prefixes (070–078) in validation logic and reject invalid prefixes (060, 069, 079)
  • Sanitize user input (remove spaces, hyphens, parentheses) before validation
  • MNP is not yet available in Sri Lanka (expected 2026); current prefixes reliably indicate operator
  • Never block or rate-limit emergency numbers (110, 112, 119, 1990)
  • Comply with PDPA data protection requirements for phone number collection and storage
  • Implement proper error handling with clear, actionable messages
  • Monitor the TRC official website (http://www.trc.gov.lk) for regulatory updates

Security best practices:

  • Encryption: Encrypt phone numbers at rest using AES-256 or equivalent
  • Transmission: Use TLS 1.2+ for all API calls transmitting phone numbers
  • Access control: Implement role-based access; limit who can view or export phone numbers
  • Logging: Log access to phone number data for audit trails (PDPA requirement)
  • Anonymization: Hash or mask phone numbers in logs and error messages
  • Rate limiting: Prevent enumeration attacks by limiting validation API calls per IP
  • Input validation: Sanitize all input to prevent injection attacks

Testing strategies:

javascript
// Test cases for validation functions
const testCases = [
  // Valid formats
  { input: '0771234567', expected: true, description: 'Domestic format' },
  { input: '+94771234567', expected: true, description: 'International with +' },
  { input: '94771234567', expected: true, description: 'International without +' },
  { input: '+94 77 123 4567', expected: true, description: 'Formatted with spaces' },

  // Invalid formats
  { input: '0601234567', expected: false, description: 'Invalid prefix 060' },
  { input: '0791234567', expected: false, description: 'Invalid prefix 079' },
  { input: '077123456', expected: false, description: 'Too short' },
  { input: '07712345678', expected: false, description: 'Too long' },
  { input: '1234567890', expected: false, description: 'Random 10 digits' },

  // Edge cases
  { input: '', expected: false, description: 'Empty string' },
  { input: '+94', expected: false, description: 'Country code only' },
  { input: '112', expected: true, description: 'Emergency number' }
];

// Run tests
testCases.forEach(test => {
  const result = validateSriLankanNumber(test.input);
  console.assert(result === test.expected,
    `Failed: ${test.description} - Input: "${test.input}"`);
});

Implement the JavaScript validation functions provided in this guide, expand them with comprehensive error handling, and follow security best practices for telecommunications data.

Related topics: