phone number standards
phone number standards
Indonesia Phone Numbers: Format, Area Code & Validation Guide
Comprehensive guide covering Indonesian phone number formats, area codes, validation techniques, and best practices for developers working with Indonesian telecommunications.
Indonesia Phone Numbers: Format, Area Code & Validation Guide
Introduction
Building an application for Indonesian users requires a robust system for handling Indonesian phone numbers. This comprehensive guide covers Indonesian phone number formats, area codes, validation techniques, and best practices for developers. Whether you're implementing E.164 international format conversion, validating mobile and landline numbers, or handling operator-specific prefixes (Telkomsel, Indosat, XL Axiata), you'll learn everything from basic formatting to advanced validation rules and error handling for the Indonesian telecommunications market.
What you'll learn:
- Indonesian phone number format patterns (mobile, geographic, special service)
- Complete area code reference for major cities (Jakarta 021, Surabaya 031, Bandung 022)
- Python validation code with regex patterns
- E.164 international format conversion (+62 country code)
- Operator prefix handling and number portability considerations
Indonesian Mobile Operators and Number Prefixes
Indonesia's telecommunications sector serves millions across thousands of islands, presenting unique challenges for developers. Major players – Telkomsel, Indosat Ooredoo, XL Axiata, and Smartfren – compete intensely, influencing pricing strategies and service offerings that impact application design.
Operator-Specific Mobile Prefixes:
| Operator | Prefixes | Notes |
|---|---|---|
| Telkomsel | 0811, 0812, 0813, 0821, 0822, 0823, 0852, 0853 | Largest operator, dominant market share |
| Indosat Ooredoo | 0814, 0815, 0816, 0855, 0856, 0857, 0858 | Second major operator |
| XL Axiata | 0817, 0818, 0819, 0859, 0877, 0878 | Third major operator |
| Smartfren | 0881, 0882, 0883, 0884, 0885, 0886, 0887, 0888, 0889 | CDMA-based, expanding LTE |
| Tri (3) | 0895, 0896, 0897, 0898, 0899 | Budget-focused operator |
Technical implications: Number portability (implemented since 2018) lets users retain numbers when switching operators. Prefix-based operator identification may not be accurate for routing. Validate prefix ranges but don't rely solely on them for operator detection in production systems.
The Indonesian telecom market is projected to reach $14.36 billion by 2029, growing at a CAGR of 1.01% (Mordor Intelligence, 2025-2029 forecast). Increasing mobile penetration and 5G rollout drive demand for robust, future-proof phone number validation systems. Prepare your application to scale with this growth.
Regulatory Framework and Market Evolution
The Ministry of Communication and Information Technology (Kemenkominfo) regulates Indonesia's telecommunications landscape, controlling number allocation, service provider responsibilities, technical standards, and consumer protection. Understanding these regulations ensures your application complies with local laws and provides a trustworthy user experience.
Key Regulations:
- Peraturan Menteri Komunikasi dan Informatika No. 6 Tahun 2015: National Numbering Plan – defines number structure, allocation, and format requirements
- Peraturan Menteri Komunikasi dan Informatika No. 2 Tahun 2018: Number Portability – allows subscribers to retain numbers when switching operators (effective since November 2018)
- PP No. 52 Tahun 2000: Telecommunications Operations – governs service provider licensing and responsibilities
Implementation Requirements:
- Number Format Compliance: Store all numbers following the national numbering plan structure
- Prefix Validation: Validate against currently allocated operator prefixes (updated quarterly by Kemenkominfo)
- Data Retention: Comply with Government Regulation No. 71 of 2019 regarding Electronic System and Transaction Administration
- User Consent: Obtain explicit consent for phone number collection and usage per Law No. 27 of 2022 on Personal Data Protection
- Security: Implement encryption for stored phone numbers (recommended: AES-256)
- Audit Trail: Maintain logs of number validation attempts for regulatory compliance
Multiple operators with varying service offerings and coverage areas add complexity to number validation. Track operator prefixes and their associated services for accurate validation and routing.
Technical Implementation Guidelines
Indonesian Phone Number Formats Explained
Indonesian phone numbers follow specific formats based on type: geographic (landline), mobile, or special service. Understanding these formats is the first step to building a reliable validation system.
Major Geographic Area Codes:
| Area Code | Region/City | Digits After Code |
|---|---|---|
| 021 | Jakarta (capital) | 7-8 digits |
| 022 | Bandung, West Java | 7-8 digits |
| 024 | Semarang, Central Java | 7-8 digits |
| 031 | Surabaya, East Java | 7-8 digits |
| 0274 | Yogyakarta | 6-7 digits |
| 061 | Medan, North Sumatra | 7-8 digits |
| 0411 | Makassar, South Sulawesi | 6-7 digits |
| 0361 | Denpasar, Bali | 6-7 digits |
| 0341 | Malang, East Java | 6-7 digits |
| 0251 | Bogor, West Java | 6-7 digits |
| 0542 | Balikpapan, East Kalimantan | 6-7 digits |
| 0561 | Pontianak, West Kalimantan | 6-7 digits |
Number Type Examples with Annotations:
-
Geographic Numbers (Landline):
- Format:
0[2-9][X]X-XXXXXXX(where X varies by region) - Example:
021-12345678(Jakarta, 8-digit subscriber) - Example:
0274-123456(Yogyakarta, 6-digit subscriber) - Total length: 9-11 digits including leading 0
- Format:
-
Mobile Numbers:
- Format:
08XX-XXXX-XXXX(11-13 digits total) - Example:
0812-3456-7890(Telkomsel, 11 digits after 0) - Example:
0881-2345-6789(Smartfren, 11 digits after 0) - Always start with
08, followed by 2-3 digit operator prefix
- Format:
-
Special Service Numbers:
- Emergency:
110(Police),113(Fire),118(Ambulance),119(Disaster) - Toll-free:
0800-XXX-XXXX(8-11 digits after 0800) - Premium services:
0809-XXX-XXXX - Short codes: 3-6 digit service numbers (banking, customer service)
- Emergency:
How to Validate Indonesian Phone Numbers (Python Code)
Implement comprehensive validation patterns based on Kemenkominfo regulations.
E.164 International Format:
Indonesia's country code is +62. When converting to E.164:
- Remove leading
0from domestic format - Prepend
+62 - Example:
0812-3456-7890→+6281234567890 - E.164 format:
+62XXXXXXXXXX(13-15 digits total)
Here are comprehensive Python validation examples:
import re
def validate_geographic(number):
"""Validate Indonesian landline numbers."""
pattern = r'^0(2[1-9]|[3-9]\d{1,2})\d{6,8}$'
return bool(re.match(pattern, number))
def validate_mobile(number):
"""Validate Indonesian mobile numbers with operator prefix checking."""
# Comprehensive operator prefixes as of 2024
valid_prefixes = (
'0811', '0812', '0813', '0821', '0822', '0823', '0852', '0853', # Telkomsel
'0814', '0815', '0816', '0855', '0856', '0857', '0858', # Indosat
'0817', '0818', '0819', '0859', '0877', '0878', # XL Axiata
'0881', '0882', '0883', '0884', '0885', '0886', '0887', '0888', '0889', # Smartfren
'0895', '0896', '0897', '0898', '0899' # Tri (3)
)
if not any(number.startswith(prefix) for prefix in valid_prefixes):
return False
pattern = r'^08\d{9,11}$' # 11-13 total digits
return bool(re.match(pattern, number))
def validate_e164(number):
"""Validate E.164 international format (+62XXXXXXXXXX)."""
pattern = r'^\+628\d{8,11}$' # +62 followed by 8 (mobile) and 8-11 more digits
return bool(re.match(pattern, number))
def convert_to_e164(number):
"""Convert Indonesian domestic format to E.164."""
cleaned = re.sub(r'[^\d+]', '', number) # Remove formatting
if cleaned.startswith('+62'):
return cleaned # Already E.164
if cleaned.startswith('62'):
return '+' + cleaned
if cleaned.startswith('0'):
return '+62' + cleaned[1:] # Replace leading 0 with +62
return None # Invalid format
# Example usage with tests
test_cases = [
("08123456789", True), # Valid Telkomsel
("0812345678", False), # Too short
("+6281234567890", True), # Valid E.164
("021-1234567", True), # Valid Jakarta landline
("08991234567", True), # Valid Tri
]
for number, expected in test_cases:
if number.startswith('+'):
result = validate_e164(number)
elif number.startswith('08'):
result = validate_mobile(number)
else:
result = validate_geographic(number)
status = "✓" if result == expected else "✗"
print(f"{status} {number}: {result}")These functions use regular expressions to match expected number formats. Keep these patterns updated as regulations change. Regularly review and update them to maintain accuracy – patterns do not remain static.
Indonesian Area Code Validation and Error Handling
Robust error handling is essential for a user-friendly experience. Anticipate and handle error scenarios like invalid input formats and incorrect area codes.
# Complete list of major Indonesian area codes (updated 2024)
VALID_AREA_CODES = [
# Major cities (2-digit codes)
"021", # Jakarta
"022", # Bandung
"024", # Semarang
"031", # Surabaya
"061", # Medan
# 3-digit codes
"0251", # Bogor
"0274", # Yogyakarta
"0341", # Malang
"0361", # Denpasar (Bali)
"0411", # Makassar
"0542", # Balikpapan
"0561", # Pontianak
"0511", # Banjarmasin
"0741", # Jambi
"0721", # Bandar Lampung
# 4-digit codes for smaller regions
"0370", # Lombok
"0380", # Banyuwangi
]
def format_number(number):
cleaned = re.sub(r'[^\d]', '', number) # Removes non-digit characters
if not cleaned:
raise ValueError("Invalid number format: Input is empty or contains only non-digit characters.")
return cleaned
def validate_area_code(number):
"""Validate area code with support for 2, 3, and 4-digit codes."""
# Check 4-digit codes first (most specific)
if number[:4] in [code for code in VALID_AREA_CODES if len(code) == 4]:
return number[:4]
# Check 3-digit codes
if number[:3] in [code for code in VALID_AREA_CODES if len(code) == 3]:
return number[:3]
# Check 2-digit codes (0 + 2 digits)
if number[:3] in [code for code in VALID_AREA_CODES if len(code) == 3]:
return number[:3]
raise ValueError(f"Invalid area code: {number[:4]} is not recognized. Check https://www.kominfo.go.id for current allocations.")
# Example usage
try:
formatted_number = format_number("+62 812-345-6789")
validated_area_code = validate_area_code(formatted_number)
print("Formatted number:", formatted_number)
print("Validated area code:", validated_area_code)
except ValueError as e:
print("Error:", e)This code handles invalid input formats and area codes by raising ValueError exceptions. Provide informative error messages to guide users toward correcting their input. For example, if an area code is invalid, suggest a list of valid area codes.
Common Indonesian Phone Number Validation Challenges
Implementing Indonesian phone number validation presents specific challenges. Here are common issues and their solutions.
How to Handle Multiple Indonesian Phone Number Formats
Indonesian phone numbers can be written in various formats: international, local, with different separator characters. Normalize these formats before validation by removing spaces, hyphens, and other non-digit characters. Use regular expressions to extract relevant digits and reformat the number into a consistent format.
def normalize_phone_number(number):
"""Normalize Indonesian phone number to consistent format."""
# Remove all non-digit characters except + at start
cleaned = re.sub(r'(?<!^)\+|[^\d+]', '', number)
# Handle various international format prefixes
if cleaned.startswith('+62'):
return cleaned
if cleaned.startswith('0062'):
return '+62' + cleaned[4:]
if cleaned.startswith('62'):
return '+62' + cleaned[2:]
if cleaned.startswith('0'):
return cleaned # Domestic format
return None # Invalid format
# Examples
test_inputs = [
"0812-3456-7890",
"+62 812 3456 7890",
"62-812-3456-7890",
"0062 812 3456 7890"
]
for input_num in test_inputs:
normalized = normalize_phone_number(input_num)
print(f"{input_num} → {normalized}")Validating Indonesian Mobile Operator Prefixes
Operator prefixes can change, and number portability (implemented November 2018) allows users to switch operators while keeping their number. Maintain an updated database of operator prefixes and handle number portability scenarios.
Recommended Libraries and APIs:
-
phonenumbers library (Google libphonenumber):
pythonimport phonenumbers from phonenumbers import carrier, geocoder number = phonenumbers.parse("+6281234567890", "ID") print(carrier.name_for_number(number, "en")) # Note: May be inaccurate due to portability print(geocoder.description_for_number(number, "en")) -
Numverify API (https://numverify.com) – Real-time validation with carrier lookup
-
Abstract API Phone Validation (https://www.abstractapi.com/phone-validation-api) – Includes Indonesian numbers
-
Twilio Lookup API – Production-grade validation with carrier and type information
Number Portability Decision Tree:
Phone Number Input
↓
[1] Format Validation
├─ Invalid format → Reject with error message
└─ Valid format → Continue
↓
[2] Prefix Check
├─ Unknown prefix → Reject
└─ Known prefix → Continue
↓
[3] Operator Identification Strategy
├─ Option A: Use prefix for initial routing (fast, may be inaccurate)
├─ Option B: Query operator lookup API (accurate, adds latency)
└─ Option C: Hybrid – cache known ports, query unknowns
↓
[4] For Critical Operations (payments, 2FA)
└─ Always verify via SMS/call test before trusting
Best Practice: Don't rely solely on prefix-based operator detection. For critical workflows, implement a verification step (SMS OTP) to confirm the number is active and reachable.
Edge Cases and Fallback Validation
Implement fallback validation for edge cases. Some numbers might not conform to standard formats due to specific service offerings or temporary promotions. Use a fallback mechanism – manual verification or less strict validation rules – to handle these situations.
Common Edge Cases and Fallback Strategies:
-
Newly Allocated Prefixes:
- Issue: Kemenkominfo allocates new prefixes quarterly
- Fallback: If format is valid but prefix unknown, log for manual review instead of hard reject
- Example: New 0854 prefix might not be in your database yet
-
International Format Variations:
- Edge case:
62 812 3456 7890(no plus),0062812…(double zero prefix) - Strategy: Normalize by removing spaces, converting
0062or62to+62
- Edge case:
-
VoIP/Virtual Numbers:
- Issue: Some services use non-standard ranges (e.g., 0804 for VoIP)
- Fallback: Maintain separate validation rules for known virtual ranges
-
Ported Numbers:
- Issue: Number shows Telkomsel prefix but user switched to XL
- Strategy: Accept number if prefix was ever valid, use API for real-time carrier detection
-
Short Codes Entered as Full Numbers:
- Edge case: User enters
110(emergency) or1500111(bank hotline) - Fallback: Detect length < 9 digits, provide specific error: "Short codes not supported"
- Edge case: User enters
def validate_with_fallback(number):
"""Comprehensive validation with fallback strategies."""
cleaned = re.sub(r'[^\d+]', '', number)
# Normalize international formats
if cleaned.startswith('0062'):
cleaned = '+62' + cleaned[4:]
elif cleaned.startswith('62') and not cleaned.startswith('+'):
cleaned = '+62' + cleaned[2:] if len(cleaned) > 11 else '0' + cleaned[2:]
# Try strict validation first
if validate_mobile(cleaned) or validate_geographic(cleaned) or validate_e164(cleaned):
return {'valid': True, 'number': cleaned, 'method': 'strict'}
# Fallback: Check if format is plausible but prefix unknown
if re.match(r'^08\d{9,11}$', cleaned): # Mobile format but unknown prefix
return {
'valid': True,
'number': cleaned,
'method': 'fallback',
'warning': 'Unknown prefix – may be newly allocated. Manual review recommended.'
}
# Hard reject
return {'valid': False, 'number': cleaned, 'error': 'Invalid Indonesian phone number'}Mobile Data dominates the Indonesian Communication Services market, projected to reach US$9.7bn in 2025 (Statista). This underscores the importance of robust mobile number validation. The Indonesian government is actively preparing data privacy and security regulations (DataGuidance), highlighting the need for secure phone number handling and compliance with evolving regulations.
Recent Developments and Future Outlook
The Indonesian telecommunications sector is constantly evolving. Stay informed about recent developments and future trends to build a future-proof validation system.
How 5G Affects Indonesian Phone Number Formats
5G rollout is transforming the Indonesian telecom landscape.
5G Impact on Phone Numbers:
- Number formats remain unchanged: 5G uses existing mobile number ranges; no new prefixes required for 5G-specific services
- eSIM adoption: Increasing use of eSIM may lead to more virtual number allocations (typically using existing mobile prefixes)
- IoT/M2M numbers: 5G IoT devices may receive dedicated number ranges in future allocations – monitor Kemenkominfo announcements
- Validation requirement: No changes to validation logic needed for 5G networks; existing mobile validation patterns remain valid
Monitor regulatory updates from Kemenkominfo and adapt your validation system accordingly.
Regulatory Modernization
Kemenkominfo continuously modernizes regulations, including number allocation policies and consumer protection measures. Stay updated on these changes to maintain compliance.
Resources for Monitoring Regulatory Updates:
-
Official Kemenkominfo Website: https://www.kominfo.go.id
- Check "Regulasi" (Regulations) section quarterly
- Subscribe to press releases and announcements
-
National Numbering Plan Updates: https://postel.go.id
- Directorate General of Posts and Telecommunications
- Publishes prefix allocation updates
-
Industry Associations:
- ATSI (Asosiasi Telekomunikasi Seluruh Indonesia): https://www.atsi.or.id
- Monitor operator announcements and industry news
-
Legal Database: JDIH Kemenkominfo (https://jdih.kominfo.go.id)
- Search for "Penomoran" (numbering) regulations
- Download full regulation texts
-
Set up monitoring:
python# Recommended: Check for updates quarterly # Create calendar reminder to review: # - New prefix allocations # - Regulation amendments # - Operator mergers/acquisitions
Conclusion
This guide covers comprehensive Indonesian phone number validation. Follow these best practices and stay informed about the evolving telecom landscape to build a robust, user-friendly application for the Indonesian market. Prioritize accuracy, security, and compliance with local regulations to enhance user experience and build trust.
Quick Implementation Checklist
Phase 1: Core Validation (Week 1)
- Implement basic format validation for mobile (08XX) and geographic (0XX) numbers
- Add E.164 conversion function (+62 format)
- Create operator prefix database with major carriers (Telkomsel, Indosat, XL, Smartfren, Tri)
- Implement input normalization (remove spaces, hyphens, handle international formats)
Phase 2: Enhanced Validation (Week 2)
- Add comprehensive area code validation for major cities
- Implement number portability handling strategy (API or prefix-based with warnings)
- Create unit tests covering edge cases (new prefixes, VoIP, ported numbers)
- Add fallback validation for unknown-but-plausible formats
Phase 3: Compliance & Production (Week 3)
- Review compliance with Peraturan Menteri No. 6/2015 and No. 2/2018
- Implement data protection measures (encryption, consent collection) per UU No. 27/2022
- Set up audit logging for validation attempts
- Create error messages in both Indonesian and English
- Integrate third-party validation API (Twilio Lookup or Numverify) for critical operations
Phase 4: Maintenance (Ongoing)
- Schedule quarterly prefix database updates from Kemenkominfo
- Monitor operator announcements for mergers/new allocations
- Review validation logs monthly for unknown prefixes
- Update regex patterns when new number ranges are allocated
- Test validation against real operator data samples
Production Readiness Checklist:
- Validation handles all three formats (domestic, E.164, with/without formatting)
- Error messages are clear and actionable
- Performance: Validation completes in <50ms per number
- Security: Phone numbers encrypted at rest (AES-256)
- Monitoring: Track validation failure rates by error type
- Documentation: API docs include examples for each number type