Country Guides

Kenya Phone Number Format: +254 Country Code, Validation & Prefixes

Master Kenya phone numbers with +254 country code. Covers validation regex, E.164 format, Safaricom/Airtel/Telkom prefixes, area codes, MNP implementation, and emergency numbers for developers.

JH
Jacky Hossein
β€’ Principal Telecommunications Architect β€’ Published Oct 27, 2026 β€’ 8 min read

E.164 & SMS Quick Reference: Master Kenya phone numbers with +254 country code. Covers validation regex, E.164 format, Safaricom/Airtel/Telkom prefixes, area codes, MNP implementation, and emergency numbers for developers. Need real-time carrier, porting, and line-type validation beyond regex? Run live lookups with SMSRoute HLR Lookup or send directly over Tier-1 routes via the SMSRoute SMS API.

Kenya phone numbers use the +254 country code and follow the ITU-T E.164 international standard for formatting. This guide provides developers with a comprehensive framework for validating and integrating Kenya's phone numbering system. You'll learn how to validate mobile numbers for Safaricom, Airtel, Telkom, and Equitel, implement Mobile Number Portability (MNP), parse landline area codes, and handle emergency services correctly.

Kenya Phone Number Structure: E.164 Standard Explained

Kenya adheres to the international E.164 phone number format standard (version 11/2010, with amendments through 06/2020), a globally recognized framework for telephone numbering. This standard ensures consistency and interoperability in international telecommunications, which is essential when building applications that handle phone validation, SMS delivery, or call routing across borders.

The E.164 standard defines a hierarchical structure for phone numbers, starting with the country code, followed by the National Significant Number (NSN). The NSN is further divided into the National Destination Code (NDC) and the subscriber number. In Kenya, the country code is +254, and the NSN is 9 digits long.

graph LR
    A[Full Number (E.164)] --> B[Country Code (+254)]
    A --> C[National Significant Number (NSN - 9 digits)]
    C --> D[National Destination Code (NDC - 2 or 3 digits)]
    C --> E[Subscriber Number (SN - 6 or 7 digits)]
    D --> F[Landline (2 digits)]
    D --> G[Mobile (3 digits)]

This structure is essential for routing calls and messages correctly. Let's break down the specific formats for landline and mobile numbers in Kenya.

Kenya Landline Phone Numbers: Area Codes by City

Landline numbers in Kenya follow a predictable 9-digit format, comprising a 2-digit area code and a 7-digit subscriber number. You should familiarize yourself with this structure to ensure accurate parsing and validation within your systems.

Format: 0[Area Code][Subscriber Number]
Example: 020 1234567
         ↓↓  ↓↓↓↓↓↓↓ Subscriber Number (7 digits)
         └└─ Area Code (2 digits)

The leading "0" is the trunk prefix, used for domestic dialing within Kenya. When dialing internationally, this "0" is omitted, and the country code (+254) is prepended.

Here's a table outlining some common area codes for major cities:

RegionArea CodeExample NumberUsage Pattern
Nairobi0200201234567Metropolitan
Mombasa0410411234567Coastal
Kisumu0570571234567Regional
Eldoret0530531234567Regional
Nakuru0510511234567Regional

This is not an exhaustive list, and you should consult the Communications Authority of Kenya (CA) for a complete list of area codes. Consider using a lookup table or API to dynamically retrieve area code information, ensuring your application remains up-to-date with any changes.

How to Validate Kenya Mobile Numbers: Safaricom, Airtel, Telkom & Equitel Prefixes

Mobile numbers in Kenya are 10 digits long, starting with a 3-digit mobile prefix followed by a 7-digit subscriber number. Understanding these prefixes is crucial for identifying the mobile network operator (MNO). The major telecommunications providers in Kenya include Safaricom (the largest operator), Airtel Kenya, Telkom Kenya, and Equitel.

function validateKenyanMobile(number) {
  const regex = /^0[17][0-9]{8}$/;
  const prefixRanges = {
    safaricom: /^0[17][0-9]{2}/,
    airtel: /^073[0-9]/,
    telkom: /^077[0-9]/,
    equitel: /^0763[0-9]{2}/
  };

  return {
    isValid: regex.test(number),
    carrier: determineCarrier(number, prefixRanges)
  };

  function determineCarrier(number, prefixRanges) {
    for (const carrier in prefixRanges) {
      if (prefixRanges[carrier].test(number)) {
        return carrier;
      }
    }
    return 'unknown';
  }
}

console.log(validateKenyanMobile('0722123456'));
console.log(validateKenyanMobile('0110123456'));
console.log(validateKenyanMobile('0730123456'));
console.log(validateKenyanMobile('0770123456'));
console.log(validateKenyanMobile('0763123456'));
console.log(validateKenyanMobile('0700123456'));
console.log(validateKenyanMobile('072212345'));
console.log(validateKenyanMobile('0800123456'));

Adapt this code to your specific needs, adding more prefixes and validation rules as required. Handle edge cases, such as invalid prefixes or incorrect number lengths. If the validateKenyanMobile function encounters a number with a valid length but an unknown prefix, it returns 'unknown' for the carrier while still indicating the number is valid, since new operators or number ranges might be introduced.

Important: In May 2019, the Communications Authority of Kenya introduced mobile prefixes starting with the digit 1. You should regularly update your validation patterns to accommodate new number ranges allocated by the CA. This proactive approach ensures your application remains compatible with the evolving Kenyan numbering system.

How to Implement Mobile Number Portability (MNP) in Kenya

Mobile Number Portability (MNP) allows subscribers to switch operators while keeping their existing number. Kenya's MNP implementation follows ITU-T E.164 Supplement 2 (updated June 2020) guidelines. You'll need to integrate with the central MNP database to verify the current operator of a ported number.

Real-time MNP Validation

Real-time validation is crucial for ensuring accurate routing and billing. Integrate with the central MNP database via an API to query the current operator of a given number.

def check_ported_number(msisdn):

    mnp_db = MNPDatabase.connect(db_host='mnp_db_host', db_user='mnp_user', db_password='mnp_password')

    try:

        current_carrier = mnp_db.query_carrier(msisdn)


        porting_status = mnp_db.get_porting_status(msisdn)

        return {
            'original_carrier': determine_original_carrier(msisdn),
            'current_carrier': current_carrier,
            'is_ported': porting_status.is_ported,
            'port_date': porting_status.port_date
        }
    except (ConnectionError, DatabaseError) as e:

        logger.error(f"MNP database error: {e}")

        return {'original_carrier': determine_original_carrier(msisdn), 'current_carrier': None, 'is_ported': False, 'port_date': None}
    finally:
        mnp_db.close()

def determine_original_carrier(msisdn):


    pass

This revised code includes error handling and a fallback mechanism. In case of database connectivity issues, the function logs the error and returns a dictionary indicating that the number's current carrier is unknown, allowing your application to gracefully handle such situations. Always implement fallback mechanisms for MNP database connectivity issues to ensure service continuity.

MNP Database Synchronization

Regular synchronization with the central MNP database is essential for maintaining accurate number information. Implement a robust synchronization process that handles potential errors and ensures data integrity.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Your Database β”‚ ─── Synchronization ─── β”‚ MNP Central DB  β”‚ ─── β”‚ Carrier Systems β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The frequency of synchronization depends on porting activity volume and your specific requirements. Consider using a delta synchronization approach to minimize data transfer and improve efficiency. This involves only synchronizing changes since the last synchronization, rather than the entire database.

MNP Implementation Timeline and Considerations

Kenya's MNP framework has evolved over time. Here are key milestones:

  • 2011: Initial MNP implementation launched by the CA. This marked a significant step towards fostering competition in the Kenyan telecommunications market. Early challenges included technical issues and inter-operator disputes.
  • 2016: Major system upgrades and process streamlining implemented to improve efficiency and reliability.
  • 2018: CA published revised MNP guidelines providing a detailed regulatory framework.
  • 2019: Enhanced verification protocols introduced to prevent unauthorized porting and strengthen consumer protection.
  • 2020: ITU-T E.164 Supplement 2 updated with international best practices for number portability.

When implementing MNP, consider these factors:

  • Consumer Protection: The CA enforces strict verification requirements to prevent unauthorized porting. Ensure your implementation adheres to these requirements. Subscribers must provide valid identification and authorization before porting requests are processed.
  • Inter-operator Agreements: Operators maintain service level agreements (SLAs) that govern the porting process, typically requiring completion within 3–5 business days. Familiarize yourself with these agreements to ensure compliance.
  • Dispute Resolution: The CA provides a framework for resolving MNP-related disputes. Contact the CA at chukuahatua@ca.go.ke for consumer complaints or info@ca.go.ke for regulatory inquiries.

Kenya Emergency Numbers: 999, 112, and Special Service Numbers

Emergency numbers require special handling in your system. Prioritize routing for these numbers and bypass any credit checks or other restrictions.

const EMERGENCY_NUMBERS = {
  GENERAL: '999',
  ALTERNATIVE: '112',
  POLICE: '911',
  FIRE: '990',
  AMBULANCE: '991'
};

function handleEmergencyCall(number) {
  if (Object.values(EMERGENCY_NUMBERS).includes(number)) {



    console.log(`Routing emergency call to ${number}`);
    return true;
  }
  console.log(`Number ${number} is not an emergency number`);
  return false;
}

handleEmergencyCall('999');
handleEmergencyCall('112');
handleEmergencyCall('911');
handleEmergencyCall('990');
handleEmergencyCall('991');
handleEmergencyCall('0722123456');

Integrate this with your call routing and emergency service protocols. Emergency calls must be processed immediately, regardless of account status or credit balance.

Best Practices for Kenya Phone Number Validation and Formatting

Implementing best practices ensures your application handles Kenyan phone numbers efficiently and reliably.

Converting Kenya Numbers to International Format (+254)

Convert local numbers to international format for international calls and SMS. This is essential for ensuring proper routing in global telecommunications systems and SMS delivery across international carriers.

function toInternationalFormat(localNumber) {

  const normalized = localNumber.replace(/^0/, '').replace(/[\s-]/g, '');

  return `+254${normalized}`;
}

console.log(toInternationalFormat('0722 123 456'));
console.log(toInternationalFormat('020-1234567'));

This function handles various input formats, removing spaces and hyphens before adding the country code. This ensures consistency and avoids potential errors.

Phone Number Validation with Regular Expressions

Robust validation prevents errors and ensures data integrity. Use regular expressions to validate number formats and identify potential issues.

const validationPatterns = {
  landline: /^0(20|41|[4-6][0-9])[0-9]{7}$/,
  mobile: /^0[17][0-9]{8}$/,
  tollFree: /^0800[0-9]{6}$/,
  premium: /^0900[0-9]{6}$/
};

function validateNumber(number, type) {
  if (!validationPatterns[type]) {
    return false;
  }
  return validationPatterns[type].test(number);
}

console.log(validateNumber('0201234567', 'landline'));
console.log(validateNumber('0722123456', 'mobile'));
console.log(validateNumber('0110123456', 'mobile'));
console.log(validateNumber('0800123456', 'tollFree'));
console.log(validateNumber('0900123456', 'premium'));
console.log(validateNumber('072212345', 'mobile'));
console.log(validateNumber('0201234567', 'mobile'));

Extend this function to include additional validation rules as needed. Update validation patterns regularly to accommodate new number ranges allocated by the CA.

Premium and Special Number Management

Premium or "golden" numbers, often featuring repeating or sequential digits, are highly sought after by businesses. These numbers enhance brand recognition and customer recall. The CA manages allocation through a structured application and evaluation process. VIP number ranges are maintained for government and security institutions.

Toll-free numbers (starting with 0800) and premium-rate numbers (starting with 0900) follow specific formats and have distinct billing rules. Ensure your application properly identifies and handles these special number types for accurate call routing and billing. Learn more about implementing 10DLC SMS registration for US-based business messaging.

Frequently Asked Questions

What is Kenya's country code for international calls? Kenya's international dialing code is +254. To call Kenya from abroad, dial +254 followed by the local number without the leading 0. For example, a Nairobi landline 020 1234567 becomes +254 20 1234567 internationally.

How do I validate a Kenyan mobile number in code? Kenyan mobile numbers are 10 digits long and start with prefixes like 07XX or 01XX. Use the regex pattern /^0[17][0-9]{8}$/ to validate the format. For carrier identification, check against known operator prefixes: Safaricom (0[17]XX), Airtel (073X), Telkom (077X), and Equitel (0763).

What are the main mobile operators in Kenya? The major mobile network operators are Safaricom (largest market share), Airtel Kenya, Telkom Kenya, and Equitel.

How does Mobile Number Portability work in Kenya? MNP allows subscribers to change operators while keeping their number. The porting process typically takes 3–5 business days and requires verification through the CA-regulated central database.

Conclusion: Implementing Kenya Phone Number Systems

This guide has equipped you with the essential knowledge and practical tools to confidently handle Kenyan phone numbers in your applications. By implementing proper validation for mobile and landline formats, integrating MNP support, and following E.164 standards, you can ensure your applications are robust, compliant, and provide a seamless experience for your users.

For the most up-to-date information on Kenya's numbering plan, area codes, and regulatory changes, consult the Communications Authority of Kenya website and official documentation.

Validate & Send SMS to Kenya With SMSRoute

Regex catches syntax mistakes, but it cannot tell you whether a mobile number is active, ported to another carrier, or reachable over SMS. Before launching OTP or transactional campaigns into Kenya, pair E.164 normalization with live carrier intelligence and direct Tier-1 termination on SMSRoute.

curl -X POST https://api.sendsmsnokyc.com/v3/messages \
  -H "x-api-key: $SMSROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["+14155551234"],
    "channel": ["sms"],
    "body": "Your verification code is 482910"
  }'
  • Live HLR & Carrier Lookup: Verify active status, roaming, and current serving network before you pay to send via SMSRoute HLR Lookup.
  • Handset-Verified Route Testing: Audit real SIM delivery, DLR latency, and Sender ID preservation with Live Carrier Testing.
  • No-KYC Instant Onboarding: Fund with crypto (BTC/USDT) or card and check exact per-country rates on our live pricing page.

Deliver Global SMS With Direct Carrier Routes

Validate E.164 numbers with live HLR lookup and deliver high-priority OTPs and alerts across 190+ countries on SMSRoute.

Try SMSRoute HLR Lookup β†’