Puerto Rico Phone Numbers: Format, Validation & Integration Guide for Developers
Validate Puerto Rico phone numbers correctly using NANP format with area codes 787 and 939. Complete guide covering validation regex, E.164 formatting, portability, and disaster recovery.
Validate Puerto Rico phone numbers correctly in your applications using this comprehensive guide to the North American Numbering Plan (NANP) format. Puerto Rico uses area codes 787 and 939 with the +1 country code, following standard 10-digit NANP formatting. This guide covers number validation, E.164 formatting, portability checks, and disaster recovery strategies for developers integrating Puerto Rican telecommunications into their systems.
What you'll learn: Puerto Rico phone number format specifications, validation regex patterns for 787 and 939 area codes, number portability implementation, PRTRB compliance requirements, and disaster recovery best practices for hurricane-prone regions.
How Does Puerto Rico's Phone Number System Work?
As a U.S. Commonwealth, Puerto Rico operates within the North American Numbering Plan (NANP), sharing the country code +1 with the United States and Canada. This integration ensures seamless communication with North American networks while maintaining a distinct regulatory framework overseen by the Puerto Rico Telecommunications Regulatory Board (PRTRB). The PRTRB handles local regulatory matters including compliance guides for telecommunications companies, consumer protection, and service quality standards, while adhering to federal FCC regulations that apply to all U.S. territories.
Mandatory 10-Digit Dialing: Puerto Rico requires 10-digit dialing (area code + 7-digit number) for all local calls due to the 787/939 overlay system. This has been mandatory since 2001 when area code 939 was introduced as an overlay to area code 787. Even calls within the same area code must include all 10 digits, as documented by AT&T and the FCC's overlay dialing requirements.
Puerto Rico Area Codes: 787 and 939 History
Puerto Rico's telecommunications infrastructure has undergone significant modernization, particularly since the introduction of its first area code, 787, in 1996. The subsequent addition of area code 939 in 2001 addressed the island's growing communication needs. This expansion, driven by increased demand, highlights the importance of building scalable systems when working with Puerto Rican phone numbers. As documented by the FCC, the Puerto Rico Telephone Company underwent several ownership changes and mergers, culminating in its acquisition by América Móvil in 2007. This history underscores the dynamic nature of the telecommunications sector in Puerto Rico.
Number Allocation Status: According to NANPA's 2024 exhaust projections, Puerto Rico's area codes 787 and 939 currently have sufficient capacity, with no immediate area code relief measures planned. The overlay system implemented in 2001 has effectively distributed numbering resources across the island. NANPA monitors utilization rates and projects exhaust dates to ensure adequate planning for future growth.
What Is the Correct Format for Puerto Rico Phone Numbers?
Understanding the structure of Puerto Rican phone numbers is fundamental for accurate validation and processing. You'll need to be familiar with the various number types and their corresponding formats.
NANP Format Structure for Puerto Rico Numbers
Puerto Rico adheres to the standard 10-digit NANP format:
Code
+1 (NPA) NXX-XXXX
Where:
+1: Country code (shared with the U.S. and Canada)
NPA: Numbering Plan Area (787 or 939)
NXX: Exchange code (first digit 2–9)
XXXX: Subscriber number
Best Practice: Always include the +1 prefix when formatting Puerto Rican numbers in international contexts. This ensures correct routing and global compatibility.
NANP N11 Code Restrictions: Exchange codes (NXX) cannot be N11 codes (211, 311, 411, 511, 611, 711, 811, 911), as these are reserved for special services by the FCC. Additionally, the first digit of the exchange code must be 2-9, not 0 or 1, as these are trunk prefixes in the NANP. Invalid exchange patterns include 0XX, 1XX, and N11, which are automatically rejected by switching equipment. According to the North American Numbering Plan, this restriction eliminates approximately 80 central office codes per area code from assignment, preserving them for operator assistance (0), long-distance dialing (1), and community services (N11).
Puerto Rico Phone Number Examples by Type
Here are some real-world examples:
Local Business Number:
Code
Local Format: (787) 234-5678
International Format: +1 787 234 5678
E.164 Format: +17872345678
Mobile Number:
Code
Local Format: (939) 876-5432
International Format: +1 939 876 5432
E.164 Format: +19398765432
Toll-Free Number (accessible from Puerto Rico):
Code
Local Format: 1-800-123-4567
International Format: +1 800 123 4567
E.164 Format: +18001234567
Premium Rate Number:
Code
Local Format: 1-900-234-5678
International Format: +1 900 234 5678
E.164 Format: +19002345678
Notice how the international format omits formatting characters, making it suitable for data processing. Consider this when designing your input fields and validation logic.
Puerto Rico Number Format and Validation Regex Table
The following table summarizes various number types and their respective formats, along with validation regular expressions you can use in your applications:
Number Type
Format
Example
Validation Regex
Notes
Landline
+1 (787/939) [2-9]XX-XXXX
+1 787-234-5678
`^+1(787
939)[2-9]\d{6}$`
Mobile
+1 (787/939) [2-9]XX-XXXX
+1 939-876-5432
`^+1(787
939)[2-9]\d{6}$`
Toll-Free
+1 8XX [2-9]XX-XXXX
+1 800-123-4567
^\+18[0-8][0-9][2-9]\d{6}$
Includes 800, 888, 877, 866, 855, 844, 833
Premium Rate
+1 900 [2-9]XX-XXXX
+1 900-234-5678
^\+1900[2-9]\d{6}$
Higher charges apply
Validation Notes:
Input Sanitization Required: Before applying regex, strip spaces, parentheses, hyphens, and dots from user input
Exchange Code Validation: The fourth digit (first of NXX) must be 2-9; reject 0XX, 1XX, and N11 patterns
Error Messages: Return specific error codes: INVALID_LENGTH, INVALID_AREA_CODE, INVALID_EXCHANGE, INVALID_FORMAT
Formatted Input Handling: Use this regex for formatted input: ^\+?1?[\s.-]?\(?([2-9]\d{2})\)?[\s.-]?([2-9]\d{2})[\s.-]?(\d{4})$
Understanding these formats and using the provided regular expressions will ensure your application handles Puerto Rican phone numbers correctly.
How to Validate Puerto Rico Phone Numbers in Your Application
This section provides practical guidance for integrating Puerto Rican phone numbers into your systems. You'll learn about validation, portability checks, and system requirements.
Python Validation Function for Puerto Rico Numbers
Implement a robust validation system. Here's an enhanced Python function with input sanitization and error handling for validating Puerto Rican numbers:
Python
import re
from enum import Enum
from typing importOptional, Dict, AnyclassValidationError(Enum):
INVALID_LENGTH = "Phone number must be exactly 10 digits"
INVALID_AREA_CODE = "Area code must be 787 or 939"
INVALID_EXCHANGE = "Exchange code must start with 2-9 and cannot be N11"
INVALID_FORMAT = "Invalid phone number format"
VALID = "Valid phone number"defsanitize_phone_number(phone_number: str) -> str:
"""Remove all formatting characters and normalize input."""# Remove common formatting characters
sanitized = re.sub(r'[\s\-\(\)\.]', '', phone_number)
# Remove leading +1 or 1 if presentif sanitized.startswith('+1'):
sanitized = sanitized[2:]
elif sanitized.startswith('1') andlen(sanitized) == 11:
sanitized = sanitized[1:]
return sanitized
defvalidate_pr_number(phone_number: str) -> Dict[str, Any]:
"""Validate Puerto Rican phone numbers with comprehensive error handling.
Args:
phone_number: Phone number in any common format
Returns:
Dictionary with 'valid' (bool), 'error' (ValidationError),
'normalized' (str in E.164 format if valid)
"""# Sanitize input
cleaned = sanitize_phone_number(phone_number)
# Check lengthiflen(cleaned) != 10:
return {
'valid': False,
'error': ValidationError.INVALID_LENGTH,
'normalized': None
}
# Extract components
area_code = cleaned[:3]
exchange = cleaned[3:6]
subscriber = cleaned[6:]
# Validate area codeif area_code notin ['787', '939']:
return {
'valid': False,
'error': ValidationError.INVALID_AREA_CODE,
'normalized': None
}
# Validate exchange codeif exchange[0] notin'23456789': # First digit must be 2-9return {
'valid': False,
'error': ValidationError.INVALID_EXCHANGE,
'normalized': None
}
# Check for N11 patternif exchange[1] == '1'and exchange[2] == '1':
return {
'valid': False,
'error': ValidationError.INVALID_EXCHANGE,
'normalized': None
}
# Valid number - return E.164 formatreturn {
'valid': True,
'error': ValidationError.VALID,
'normalized': f'+1{cleaned}'
}
# Example usage with various inputs
test_cases = [
"+1 787-234-5678", # Valid - formatted"(939) 876-5432", # Valid - parentheses"7872345678", # Valid - no formatting"1-787-234-5678", # Valid - with leading 1"+1 787-111-5678", # Invalid - N11 exchange"+1 787-134-5678", # Invalid - exchange starts with 1"787234567", # Invalid - too short"+1 809-234-5678", # Invalid - wrong area code
]
for test in test_cases:
result = validate_pr_number(test)
print(f"{test:20} -> {result['error'].value:40} | {result['normalized']}")
This enhanced function includes input sanitization, comprehensive validation, and proper error handling suitable for production use. The function returns structured error information that can be used for user feedback or logging.
Number portability allows users to retain their numbers when switching providers. The FCC mandates wireless local number portability (WLNP) throughout Puerto Rico, available since November 2003. Understanding portability is crucial for accurate call routing and carrier identification.
Local Number Portability (LNP) Overview:
Process Timeline: Wireless-to-wireless ports typically complete within 2.5 hours; wireline-to-wireless ports may take several days according to FCC guidelines
Requirements: Valid service request, matching account information (name, address), no outstanding balance requirement for porting (though early termination fees still apply)
Database Providers: LNP queries utilize the Number Portability Administration Center (NPAC) system, which maintains the authoritative database of ported numbers using Location Routing Numbers (LRNs)
LNP Query Methods:
SS7/TCAP Queries: Real-time database lookups via Common Channel Signaling Network (CCSN)
API-Based Services: Commercial LNP lookup APIs (e.g., Twilio Lookup API, Telnyx Number Lookup, Bandwidth Number Management API)
Local Routing Number (LRN) Dips: Network-level queries that return the current serving switch for a ported number
Python
# Example framework for portability checking with API integrationimport requests
from typing importOptional, Dict, AnyclassPortabilityChecker:
"""Check number portability status using LNP database APIs."""def__init__(self, api_key: str, api_endpoint: str):
self.api_key = api_key
self.api_endpoint = api_endpoint
defcheck_portability_status(self, phone_number: str) -> Dict[str, Any]:
"""Check if a number is ported and retrieve carrier information.
Args:
phone_number: E.164 formatted number (+17872345678)
Returns:
Dictionary with portability status, current carrier,
original carrier, and porting date
"""# Normalize to E.164 formatifnot phone_number.startswith('+1'):
phone_number = f'+1{phone_number}'try:
# Example API call (replace with actual LNP provider)
response = requests.get(
f'{self.api_endpoint}/lookup/{phone_number}',
headers={'Authorization': f'Bearer {self.api_key}'},
timeout=5
)
response.raise_for_status()
data = response.json()
return {
'eligible': True,
'is_ported': data.get('ported', False),
'current_carrier': data.get('current_carrier'),
'original_carrier': data.get('original_carrier'),
'line_type': data.get('line_type'), # 'wireless', 'landline', 'voip''porting_date': data.get('porting_date'),
'lrn': data.get('lrn'), # Location Routing Number'restrictions': self._check_restrictions(data)
}
except requests.RequestException as e:
return {
'eligible': False,
'error': str(e),
'restrictions': ['API_ERROR']
}
def_check_restrictions(self, data: Dict) -> list:
"""Identify any porting restrictions."""
restrictions = []
# Check for common restrictionsif data.get('under_contract'):
restrictions.append('EARLY_TERMINATION_FEE_APPLIES')
if data.get('prepaid_service'):
restrictions.append('PREPAID_RESTRICTIONS_MAY_APPLY')
ifnot data.get('account_active'):
restrictions.append('ACCOUNT_MUST_BE_ACTIVE')
return restrictions
# Example usage
checker = PortabilityChecker(
api_key='your_api_key',
api_endpoint='https://api.lnp-provider.com/v1'
)
status = checker.check_portability_status('+17872345678')
print(f"Ported: {status['is_ported']}")
print(f"Current Carrier: {status['current_carrier']}")
print(f"Restrictions: {status['restrictions']}")
Porting Process Details:
Documentation Required: Recent bill, account number, PIN/password, authorized user verification
Cooling-Off Period: No mandatory cooling-off period in the U.S.; porting can occur immediately upon service activation
Costs: Carriers may charge porting fees (typically $0-$25); must be disclosed upfront per FCC regulations
Dispute Resolution: Contact the FCC if carriers refuse valid porting requests or impose unreasonable delays
System Performance Requirements for Puerto Rico Telecom
Your system should meet specific requirements to handle Puerto Rican phone numbers effectively. These specifications are based on FCC service quality standards and telecommunications industry best practices.
Requirement Type
Specification
Implementation Note
Regulatory Basis
API Latency
< 200 ms
Critical for real-time validation and call setup; measured from request to response
ITU-T G.114 recommendation
Availability
99.99%
Equivalent to <52.6 minutes downtime per year; required for carrier-grade systems
Telco industry standard (99.99% "four nines")
Data Retention
7 years
Legal requirement for call detail records (CDRs) and billing information
FCC Part 42 recordkeeping requirements
Throughput
≥1,000 requests/sec
Minimum concurrent validation requests for enterprise systems
Based on carrier-grade performance
Failover Time
< 30 seconds
Maximum acceptable service interruption during disaster scenarios
NANP reliability guidelines
Backup Frequency
Every 24 hours
Incremental backups with full weekly backups recommended
Disaster recovery best practices
PRTRB Compliance Requirements:
Service Quality Standards: Maintain call completion rates >95%, per PRTRB regulations
Consumer Protection: Provide clear pricing disclosure, accessible customer service (611), and complaint resolution mechanisms
Reporting Obligations: Submit quarterly service quality reports and annual compliance certifications to PRTRB
Emergency Services: Ensure 911 routing compliance with E911 Phase II location accuracy requirements (<50 meters for 67% of calls)
Performance Monitoring:
Implement real-time monitoring for API response times, error rates, and availability metrics
Set up automated alerts for threshold violations (e.g., latency >150ms sustained, error rate >0.1%)
Conduct monthly capacity planning reviews to anticipate scaling needs
Perform quarterly disaster recovery drills to verify RTO/RPO targets
To recap this section, prioritize robust validation, incorporate portability checks, and ensure your system meets the defined performance and reliability requirements.
How to Build Disaster-Resilient Phone Systems for Puerto Rico
Puerto Rico is susceptible to natural disasters, making disaster recovery planning paramount. Design your systems to withstand and recover from such events. As highlighted in the GAO report (GAO-24-105557), disaster recovery efforts are ongoing following Hurricane Maria, emphasizing the need for robust planning.
Technical Architecture for Disaster Recovery:
Multi-Region Deployment:
Deploy primary infrastructure in Puerto Rico with secondary regions in mainland U.S. (Florida, Texas, or Virginia)
Use cloud providers with Puerto Rico presence: AWS (us-east-1), Azure (East US), Google Cloud (us-east1)
Implement active-active or active-passive failover configurations
Network Redundancy:
Utilize multiple telecommunications carriers for diverse routing paths
Implement SIP trunking with automatic failover across carriers
Maintain both terrestrial fiber and satellite backup connectivity
Data Replication:
Real-time database replication to off-island locations (RPO: <15 minutes)
Use distributed databases (e.g., AWS DynamoDB Global Tables, Google Cloud Spanner)
Implement automated snapshot backups every 6 hours with 30-day retention
Disaster Recovery Best Practices for Hurricane-Prone Regions
Redundancy: Implement multiple routing paths and backup systems to ensure continued operation even if primary systems fail. Use carrier diversity with at least three independent SIP trunk providers across different network infrastructures.
Power Independence: Maintain a minimum of 72 hours of backup power capacity to bridge potential power outages. Deploy uninterruptible power supplies (UPS) with automatic transfer switches (ATS) and diesel generators with fuel reserves. Consider solar panels with battery storage for extended outages.
Geographic Distribution: Distribute processing centers to minimize the impact of localized disruptions. Deploy primary services in Puerto Rico, secondary in southeastern U.S., and tertiary in a geographically distant region (e.g., West Coast or Europe).
Emergency Protocols: Establish automated failover systems and clear communication channels for rapid response. Implement health checks every 30 seconds with automatic failover within 30 seconds of failure detection. Maintain 24/7 NOC (Network Operations Center) coverage during hurricane season.
Recovery Objectives:
RTO (Recovery Time Objective): <30 seconds for automated failover; <4 hours for full service restoration from catastrophic failure
RPO (Recovery Point Objective): <15 minutes for data loss tolerance; critical CDRs should have <5 minute RPO
Backup Frequency: Continuous replication for production databases; incremental backups every 6 hours; full backups weekly
Testing Schedule:
Monthly: Automated failover tests during maintenance windows
Quarterly: Full disaster recovery simulations with stakeholder participation
Annually: Tabletop exercises with PRTRB and emergency management coordination
These measures are crucial for maintaining service continuity during emergencies. For example, redundancy ensures that if one system fails, another can take over seamlessly. Geographic distribution minimizes the impact of localized events. Furthermore, the devastation caused by Hurricane Maria in 2017, which caused prolonged telecommunications outages, underscores the critical importance of robust disaster recovery planning in Puerto Rico.
Frequently Asked Questions About Puerto Rico Phone Numbers
What country code does Puerto Rico use?
Puerto Rico uses country code +1, the same as the United States and Canada. As a U.S. Commonwealth, Puerto Rico is part of the North American Numbering Plan (NANP), which means all Puerto Rican phone numbers follow the standard 10-digit format: +1 (area code) XXX-XXXX.
What are Puerto Rico's area codes?
Puerto Rico has two area codes: 787 and 939. Area code 787 was introduced in 1996 as Puerto Rico's first area code, replacing the previous system that used area code 809 (which served all Caribbean territories). Area code 939 was added in 2001 as an overlay to accommodate growing demand. Both area codes serve the entire island – there's no geographic distinction between them.
How do I dial a Puerto Rico phone number from the US?
Dial Puerto Rico numbers exactly like domestic US calls. Simply dial 1 + area code (787 or 939) + seven-digit number. For example: 1-787-234-5678. You don't need international dialing codes because Puerto Rico is part of the NANP. Standard domestic calling rates typically apply, though some carriers may charge differently for calls to U.S. territories—verify with your carrier.
Dialing from other countries:
From UK/Europe: Dial 00 (international exit code) + 1 + 787/939 + local number. Example: 00-1-787-234-5678
From Asia/Australia: Dial country-specific exit code (e.g., 0011 from Australia, 001 from Hong Kong) + 1 + area code + number
From Latin America: Dial 00 + 1 + area code + number (most countries use 00 as exit code)
Mobile phones worldwide: Use + (long press 0) + 1 + area code + number. Learn more about E.164 phone number format for international dialing standards
What is the E.164 format for Puerto Rico phone numbers?
The E.164 format for Puerto Rico phone numbers is +1 followed by the 10-digit number without spaces or formatting characters. Example: +17872345678 or +19398765432. This format complies with the ITU-T E.164 standard, which specifies a maximum length of 15 digits for international telephone numbers. E.164 format is ideal for storing phone numbers in databases, API communications, and ensuring international compatibility across telecommunications systems.
Can you port phone numbers between carriers in Puerto Rico?
Yes, number portability is available in Puerto Rico under FCC wireless local number portability (WLNP) regulations. You can transfer your Puerto Rico phone number (787 or 939) between wireless carriers and between wireless and landline services. The process typically takes 2.5 hours for wireless-to-wireless ports and several days for wireline-to-wireless ports. You must have an active account with matching name/address information. While carriers cannot refuse porting due to outstanding balances, you remain obligated to pay any early termination fees or final bills.
Porting costs and requirements:
Fees: Carriers may charge $0-$25 for number porting; the new carrier must disclose fees upfront
Required information: Account number, PIN/password, billing name and address (must match exactly), recent bill
Dispute resolution: File complaints with the FCC Consumer Complaint Center if carriers improperly deny porting requests
How do I validate a Puerto Rico phone number with regex?
Use this regex pattern to validate Puerto Rico phone numbers in E.164 format: ^\+1(787|939)[2-9]\d{6}$. This pattern matches +1, followed by area code 787 or 939, then a digit from 2-9 (exchange codes can't start with 0 or 1), and finally 6 more digits.
Regex patterns for multiple formats:
Regex
# E.164 format (strict): +17872345678
^\+1(787|939)[2-9]\d{6}$
# With spaces: +1 787 234 5678
^\+1\s(787|939)\s[2-9]\d{2}\s\d{4}$
# With hyphens: +1-787-234-5678
^\+1-(787|939)-[2-9]\d{2}-\d{4}$
# With parentheses: +1 (787) 234-5678
^\+1\s\((787|939)\)\s[2-9]\d{2}-\d{4}$
# Flexible format (all variations):
^\+?1?[\s.-]?\(?([78][38][79])\)?[\s.-]?([2-9]\d{2})[\s.-]?(\d{4})$
For production use, sanitize input first by removing all formatting characters, then apply the strict E.164 regex.
Are Puerto Rico phone numbers considered international?
No, Puerto Rico phone numbers are not considered international from the United States perspective. Puerto Rico is a U.S. Commonwealth and part of the NANP. Calls between Puerto Rico and the mainland U.S. are treated as domestic calls with no international rates or dialing codes required.
Important billing considerations: While technically domestic, some U.S. carriers treat calls to Puerto Rico as international or charge higher rates than mainland calls. Mobile carrier policies vary:
Most unlimited plans include Puerto Rico without roaming charges
Some prepaid plans may charge international rates or exclude territories
Business plans should verify Puerto Rico inclusion in rate schedules
Data roaming in Puerto Rico is typically treated as domestic by major carriers (AT&T, Verizon, T-Mobile)
Always verify with your specific carrier to understand billing practices for Puerto Rico calls and data usage.
What regulatory body oversees telecommunications in Puerto Rico?
The Puerto Rico Telecommunications Regulatory Board (PRTRB) oversees telecommunications in Puerto Rico, working in conjunction with the Federal Communications Commission (FCC). The PRTRB handles local regulatory matters including service quality standards, consumer protection, rate regulation, and compliance enforcement, while adhering to federal FCC regulations that apply to all U.S. territories. Telecommunications providers must maintain compliance with both PRTRB local requirements and FCC federal mandates.
Key PRTRB responsibilities:
Licensing and certification of telecommunications providers
Service quality monitoring and complaint resolution
Emergency services (911/E911) oversight
Consumer protection and billing standards
Infrastructure development and hurricane recovery coordination
Contact information:
FCC Consumer Complaint Center: 1-888-CALL-FCC (1-888-225-5322) or fcc.gov/complaints
PRTRB oversight: Through Puerto Rico's Joint Resolution Board (Junta de Reglamentación de Servicio Público)
How do mobile and landline numbers differ in Puerto Rico?
Puerto Rico mobile and landline numbers use the same format and area codes (787 and 939). Unlike many countries, you cannot distinguish between mobile and landline numbers by their format alone. Both number types follow the standard NANP format: +1 (787/939) XXX-XXXX. This is consistent throughout the NANP, where mobile numbers are not allocated separate prefixes.
Carrier identification methods:
HLR (Home Location Register) Lookups: Query the carrier's database to determine line type and current serving network
LNP Database Queries: Identify the current carrier through number portability records
Commercial APIs: Services like Twilio Lookup API, Telnyx Number Lookup, or Bandwidth Number Lookup provide carrier identification, line type detection, and portability status
CNAM (Caller Name) Lookups: May provide carrier information but are not always reliable for line type
These methods require API integration with telecom database providers and typically incur per-query charges.
What disaster recovery considerations apply to Puerto Rico telecom systems?
Puerto Rico's hurricane-prone location requires robust disaster recovery planning. Implement redundant routing paths, maintain 72+ hours of backup power (UPS + generators + fuel reserves), distribute processing centers geographically (primary in PR, secondary on mainland U.S., tertiary in distant region), and establish automated failover systems (RTO <30 seconds). Hurricane Maria in 2017 caused prolonged telecommunications outages lasting months in some areas, highlighting the critical need for resilience in Puerto Rico's telecom infrastructure.
Critical RTO/RPO targets:
RTO (Recovery Time Objective): <30 seconds for automated failover; <4 hours for full manual restoration
RPO (Recovery Point Objective): <15 minutes for data loss; <5 minutes for critical CDRs
Testing frequency: Monthly automated tests; quarterly full DR drills; annual tabletop exercises with PRTRB coordination
Summary: Implementing Puerto Rico Phone Numbers in Your Application
This guide has provided you with a comprehensive understanding of Puerto Rican phone numbers, from their format and validation to portability and disaster recovery considerations. By following the best practices and recommendations outlined here, you can ensure your applications handle these numbers accurately, reliably, and resiliently.
Key takeaways for Puerto Rico phone number integration:
Use area codes 787 and 939 with country code +1 in NANP format
Implement mandatory 10-digit dialing (area code required for all calls, even local)
Validate numbers using regex patterns that check exchange code constraints (first digit 2-9, no N11 codes)
Store phone numbers in E.164 format (+17872345678) for database compatibility
Implement number portability checks using LNP database APIs for accurate carrier routing
Build disaster-resilient systems with multi-region deployment, RTO <30s, RPO <15min
Maintain PRTRB and FCC compliance with 99.99% availability, service quality monitoring, and 7-year data retention
Sanitize input before validation (remove formatting characters, normalize to E.164)
Integrate HLR/LNP lookups for carrier identification since mobile/landline numbers are indistinguishable by format
✓ Implement input sanitization and E.164 normalization
✓ Add comprehensive validation with specific error codes
✓ Integrate LNP lookup for portability checking
✓ Deploy multi-region architecture for disaster resilience
✓ Configure automated monitoring and alerting
✓ Establish quarterly DR testing schedule
✓ Document PRTRB compliance procedures
✓ Train support staff on Puerto Rico-specific requirements
Stay updated on any regulatory changes from the PRTRB and FCC, and adapt your systems accordingly.
Frequently asked questions
Puerto Rican phone numbers follow the North American Numbering Plan (NANP) format: +1 (NPA) NXX-XXXX, where +1 is the country code, NPA is the area code (787 or 939), NXX is the exchange code, and XXXX is the subscriber number. Always include the +1 for international compatibility.
Use a regular expression like ^\+1(787|939)[2-9]\d{6}$ to validate Puerto Rican numbers. This regex checks for the correct country code, area code, and digit length, ensuring data integrity. Remember to adapt this to your specific programming environment.
Puerto Rico is a U.S. Commonwealth and is integrated into the North American Numbering Plan (NANP), hence sharing the +1 country code with the United States and Canada. This allows for seamless communication within North America.
Check portability status when routing calls, sending messages, or performing actions that depend on the service provider. This ensures accurate delivery and avoids issues caused by number transfers between providers.
While acceptable locally, always include the +1 country code for international contexts. Omitting it can lead to routing errors and compatibility issues with global systems. This is crucial for applications interacting with international users.
Portability checks typically involve API calls to a portability database. You'll need to implement functions to check eligibility, cooling-off periods, and any restrictions associated with the number. Replace placeholder functions with your actual implementation for accurate results.
Puerto Rico has two area codes: 787, introduced in 1996, and 939, added in 2001 to accommodate growing communication needs. Both are integrated within the North American Numbering Plan (NANP).
The Puerto Rico Telecommunications Regulatory Board (PRTRB) oversees the regulatory framework for telecommunications in Puerto Rico. While aligned with NANP standards, the PRTRB maintains its own specific regulations developers should be aware of.
Puerto Rico is prone to hurricanes and other natural disasters. Robust disaster recovery plans, including redundancy and backup systems, are crucial for maintaining communication services during emergencies, such as the prolonged outages after Hurricane Maria.
Systems handling Puerto Rican phone numbers should have low API latency (<200ms), high availability (99.99%), and data retention capabilities (7 years). This ensures real-time validation, uninterrupted service, and compliance with legal requirements.
Hurricane Maria in 2017 caused significant damage to Puerto Rico's infrastructure, resulting in prolonged internet and communication outages. This highlighted the vulnerability of existing systems and emphasized the critical need for robust disaster recovery planning.
The Puerto Rico Telecommunications Regulatory Board (PRTRB) is responsible for regulating the telecommunications sector in Puerto Rico. They oversee compliance and set specific regulations within the broader framework of the NANP.
Validate Puerto Rico phone numbers correctly in your applications using this comprehensive guide to the North American Numbering Plan (NANP) format. Puerto Rico uses area codes 787 and 939 with the +1 country code, following standard 10-digit NANP formatting. This guide covers number validation, E.164 formatting, portability checks, and disaster recovery strategies for developers integrating Puerto Rican telecommunications into their systems.
What you'll learn: Puerto Rico phone number format specifications, validation regex patterns for 787 and 939 area codes, number portability implementation, PRTRB compliance requirements, and disaster recovery best practices for hurricane-prone regions.
How Does Puerto Rico's Phone Number System Work?
As a U.S. Commonwealth, Puerto Rico operates within the North American Numbering Plan (NANP), sharing the country code +1 with the United States and Canada. This integration ensures seamless communication with North American networks while maintaining a distinct regulatory framework overseen by the Puerto Rico Telecommunications Regulatory Board (PRTRB). The PRTRB handles local regulatory matters including compliance guides for telecommunications companies, consumer protection, and service quality standards, while adhering to federal FCC regulations that apply to all U.S. territories.
Mandatory 10-Digit Dialing: Puerto Rico requires 10-digit dialing (area code + 7-digit number) for all local calls due to the 787/939 overlay system. This has been mandatory since 2001 when area code 939 was introduced as an overlay to area code 787. Even calls within the same area code must include all 10 digits, as documented by AT&T and the FCC's overlay dialing requirements.
Puerto Rico Area Codes: 787 and 939 History
Puerto Rico's telecommunications infrastructure has undergone significant modernization, particularly since the introduction of its first area code, 787, in 1996. The subsequent addition of area code 939 in 2001 addressed the island's growing communication needs. This expansion, driven by increased demand, highlights the importance of building scalable systems when working with Puerto Rican phone numbers. As documented by the FCC, the Puerto Rico Telephone Company underwent several ownership changes and mergers, culminating in its acquisition by América Móvil in 2007. This history underscores the dynamic nature of the telecommunications sector in Puerto Rico.
Number Allocation Status: According to NANPA's 2024 exhaust projections, Puerto Rico's area codes 787 and 939 currently have sufficient capacity, with no immediate area code relief measures planned. The overlay system implemented in 2001 has effectively distributed numbering resources across the island. NANPA monitors utilization rates and projects exhaust dates to ensure adequate planning for future growth.
What Is the Correct Format for Puerto Rico Phone Numbers?
Understanding the structure of Puerto Rican phone numbers is fundamental for accurate validation and processing. You'll need to be familiar with the various number types and their corresponding formats.
NANP Format Structure for Puerto Rico Numbers
Puerto Rico adheres to the standard 10-digit NANP format:
Where:
+1: Country code (shared with the U.S. and Canada)NPA: Numbering Plan Area (787 or 939)NXX: Exchange code (first digit 2–9)XXXX: Subscriber numberBest Practice: Always include the +1 prefix when formatting Puerto Rican numbers in international contexts. This ensures correct routing and global compatibility.
NANP N11 Code Restrictions: Exchange codes (NXX) cannot be N11 codes (211, 311, 411, 511, 611, 711, 811, 911), as these are reserved for special services by the FCC. Additionally, the first digit of the exchange code must be 2-9, not 0 or 1, as these are trunk prefixes in the NANP. Invalid exchange patterns include 0XX, 1XX, and N11, which are automatically rejected by switching equipment. According to the North American Numbering Plan, this restriction eliminates approximately 80 central office codes per area code from assignment, preserving them for operator assistance (0), long-distance dialing (1), and community services (N11).
Puerto Rico Phone Number Examples by Type
Here are some real-world examples:
Local Business Number:
Mobile Number:
Toll-Free Number (accessible from Puerto Rico):
Premium Rate Number:
Notice how the international format omits formatting characters, making it suitable for data processing. Consider this when designing your input fields and validation logic.
Puerto Rico Number Format and Validation Regex Table
The following table summarizes various number types and their respective formats, along with validation regular expressions you can use in your applications:
^\+18[0-8][0-9][2-9]\d{6}$^\+1900[2-9]\d{6}$Validation Notes:
INVALID_LENGTH,INVALID_AREA_CODE,INVALID_EXCHANGE,INVALID_FORMAT^\+?1?[\s.-]?\(?([2-9]\d{2})\)?[\s.-]?([2-9]\d{2})[\s.-]?(\d{4})$Understanding these formats and using the provided regular expressions will ensure your application handles Puerto Rican phone numbers correctly.
How to Validate Puerto Rico Phone Numbers in Your Application
This section provides practical guidance for integrating Puerto Rican phone numbers into your systems. You'll learn about validation, portability checks, and system requirements.
Python Validation Function for Puerto Rico Numbers
Implement a robust validation system. Here's an enhanced Python function with input sanitization and error handling for validating Puerto Rican numbers:
import re from enum import Enum from typing import Optional, Dict, Any class ValidationError(Enum): INVALID_LENGTH = "Phone number must be exactly 10 digits" INVALID_AREA_CODE = "Area code must be 787 or 939" INVALID_EXCHANGE = "Exchange code must start with 2-9 and cannot be N11" INVALID_FORMAT = "Invalid phone number format" VALID = "Valid phone number" def sanitize_phone_number(phone_number: str) -> str: """Remove all formatting characters and normalize input.""" # Remove common formatting characters sanitized = re.sub(r'[\s\-\(\)\.]', '', phone_number) # Remove leading +1 or 1 if present if sanitized.startswith('+1'): sanitized = sanitized[2:] elif sanitized.startswith('1') and len(sanitized) == 11: sanitized = sanitized[1:] return sanitized def validate_pr_number(phone_number: str) -> Dict[str, Any]: """Validate Puerto Rican phone numbers with comprehensive error handling. Args: phone_number: Phone number in any common format Returns: Dictionary with 'valid' (bool), 'error' (ValidationError), 'normalized' (str in E.164 format if valid) """ # Sanitize input cleaned = sanitize_phone_number(phone_number) # Check length if len(cleaned) != 10: return { 'valid': False, 'error': ValidationError.INVALID_LENGTH, 'normalized': None } # Extract components area_code = cleaned[:3] exchange = cleaned[3:6] subscriber = cleaned[6:] # Validate area code if area_code not in ['787', '939']: return { 'valid': False, 'error': ValidationError.INVALID_AREA_CODE, 'normalized': None } # Validate exchange code if exchange[0] not in '23456789': # First digit must be 2-9 return { 'valid': False, 'error': ValidationError.INVALID_EXCHANGE, 'normalized': None } # Check for N11 pattern if exchange[1] == '1' and exchange[2] == '1': return { 'valid': False, 'error': ValidationError.INVALID_EXCHANGE, 'normalized': None } # Valid number - return E.164 format return { 'valid': True, 'error': ValidationError.VALID, 'normalized': f'+1{cleaned}' } # Example usage with various inputs test_cases = [ "+1 787-234-5678", # Valid - formatted "(939) 876-5432", # Valid - parentheses "7872345678", # Valid - no formatting "1-787-234-5678", # Valid - with leading 1 "+1 787-111-5678", # Invalid - N11 exchange "+1 787-134-5678", # Invalid - exchange starts with 1 "787234567", # Invalid - too short "+1 809-234-5678", # Invalid - wrong area code ] for test in test_cases: result = validate_pr_number(test) print(f"{test:20} -> {result['error'].value:40} | {result['normalized']}")This enhanced function includes input sanitization, comprehensive validation, and proper error handling suitable for production use. The function returns structured error information that can be used for user feedback or logging.
Additional Language Examples:
// JavaScript/TypeScript validation function validatePRNumber(phoneNumber) { const cleaned = phoneNumber.replace(/[\s\-\(\)\.]/g, '') .replace(/^\+?1/, ''); if (cleaned.length !== 10) return { valid: false, error: 'INVALID_LENGTH' }; const areaCode = cleaned.substr(0, 3); const exchange = cleaned.substr(3, 3); if (!['787', '939'].includes(areaCode)) { return { valid: false, error: 'INVALID_AREA_CODE' }; } if (!/^[2-9]/.test(exchange) || /^[2-9]11$/.test(exchange)) { return { valid: false, error: 'INVALID_EXCHANGE' }; } return { valid: true, normalized: `+1${cleaned}` }; }// Java validation example public class PuertoRicoPhoneValidator { public static ValidationResult validate(String phoneNumber) { String cleaned = phoneNumber.replaceAll("[\\s\\-\\(\\)\\.]", "") .replaceFirst("^\\+?1", ""); if (cleaned.length() != 10) { return new ValidationResult(false, "INVALID_LENGTH", null); } String areaCode = cleaned.substring(0, 3); String exchange = cleaned.substring(3, 6); if (!areaCode.equals("787") && !areaCode.equals("939")) { return new ValidationResult(false, "INVALID_AREA_CODE", null); } if (!exchange.matches("^[2-9].*") || exchange.matches("^[2-9]11$")) { return new ValidationResult(false, "INVALID_EXCHANGE", null); } return new ValidationResult(true, "VALID", "+1" + cleaned); } }How to Check Number Portability Status
Number portability allows users to retain their numbers when switching providers. The FCC mandates wireless local number portability (WLNP) throughout Puerto Rico, available since November 2003. Understanding portability is crucial for accurate call routing and carrier identification.
Local Number Portability (LNP) Overview:
LNP Query Methods:
# Example framework for portability checking with API integration import requests from typing import Optional, Dict, Any class PortabilityChecker: """Check number portability status using LNP database APIs.""" def __init__(self, api_key: str, api_endpoint: str): self.api_key = api_key self.api_endpoint = api_endpoint def check_portability_status(self, phone_number: str) -> Dict[str, Any]: """Check if a number is ported and retrieve carrier information. Args: phone_number: E.164 formatted number (+17872345678) Returns: Dictionary with portability status, current carrier, original carrier, and porting date """ # Normalize to E.164 format if not phone_number.startswith('+1'): phone_number = f'+1{phone_number}' try: # Example API call (replace with actual LNP provider) response = requests.get( f'{self.api_endpoint}/lookup/{phone_number}', headers={'Authorization': f'Bearer {self.api_key}'}, timeout=5 ) response.raise_for_status() data = response.json() return { 'eligible': True, 'is_ported': data.get('ported', False), 'current_carrier': data.get('current_carrier'), 'original_carrier': data.get('original_carrier'), 'line_type': data.get('line_type'), # 'wireless', 'landline', 'voip' 'porting_date': data.get('porting_date'), 'lrn': data.get('lrn'), # Location Routing Number 'restrictions': self._check_restrictions(data) } except requests.RequestException as e: return { 'eligible': False, 'error': str(e), 'restrictions': ['API_ERROR'] } def _check_restrictions(self, data: Dict) -> list: """Identify any porting restrictions.""" restrictions = [] # Check for common restrictions if data.get('under_contract'): restrictions.append('EARLY_TERMINATION_FEE_APPLIES') if data.get('prepaid_service'): restrictions.append('PREPAID_RESTRICTIONS_MAY_APPLY') if not data.get('account_active'): restrictions.append('ACCOUNT_MUST_BE_ACTIVE') return restrictions # Example usage checker = PortabilityChecker( api_key='your_api_key', api_endpoint='https://api.lnp-provider.com/v1' ) status = checker.check_portability_status('+17872345678') print(f"Ported: {status['is_ported']}") print(f"Current Carrier: {status['current_carrier']}") print(f"Restrictions: {status['restrictions']}")Porting Process Details:
System Performance Requirements for Puerto Rico Telecom
Your system should meet specific requirements to handle Puerto Rican phone numbers effectively. These specifications are based on FCC service quality standards and telecommunications industry best practices.
PRTRB Compliance Requirements:
Performance Monitoring:
To recap this section, prioritize robust validation, incorporate portability checks, and ensure your system meets the defined performance and reliability requirements.
How to Build Disaster-Resilient Phone Systems for Puerto Rico
Puerto Rico is susceptible to natural disasters, making disaster recovery planning paramount. Design your systems to withstand and recover from such events. As highlighted in the GAO report (GAO-24-105557), disaster recovery efforts are ongoing following Hurricane Maria, emphasizing the need for robust planning.
Technical Architecture for Disaster Recovery:
Multi-Region Deployment:
Network Redundancy:
Data Replication:
Disaster Recovery Best Practices for Hurricane-Prone Regions
Recovery Objectives:
Testing Schedule:
These measures are crucial for maintaining service continuity during emergencies. For example, redundancy ensures that if one system fails, another can take over seamlessly. Geographic distribution minimizes the impact of localized events. Furthermore, the devastation caused by Hurricane Maria in 2017, which caused prolonged telecommunications outages, underscores the critical importance of robust disaster recovery planning in Puerto Rico.
Frequently Asked Questions About Puerto Rico Phone Numbers
What country code does Puerto Rico use?
Puerto Rico uses country code +1, the same as the United States and Canada. As a U.S. Commonwealth, Puerto Rico is part of the North American Numbering Plan (NANP), which means all Puerto Rican phone numbers follow the standard 10-digit format: +1 (area code) XXX-XXXX.
What are Puerto Rico's area codes?
Puerto Rico has two area codes: 787 and 939. Area code 787 was introduced in 1996 as Puerto Rico's first area code, replacing the previous system that used area code 809 (which served all Caribbean territories). Area code 939 was added in 2001 as an overlay to accommodate growing demand. Both area codes serve the entire island – there's no geographic distinction between them.
How do I dial a Puerto Rico phone number from the US?
Dial Puerto Rico numbers exactly like domestic US calls. Simply dial 1 + area code (787 or 939) + seven-digit number. For example: 1-787-234-5678. You don't need international dialing codes because Puerto Rico is part of the NANP. Standard domestic calling rates typically apply, though some carriers may charge differently for calls to U.S. territories—verify with your carrier.
Dialing from other countries:
What is the E.164 format for Puerto Rico phone numbers?
The E.164 format for Puerto Rico phone numbers is +1 followed by the 10-digit number without spaces or formatting characters. Example: +17872345678 or +19398765432. This format complies with the ITU-T E.164 standard, which specifies a maximum length of 15 digits for international telephone numbers. E.164 format is ideal for storing phone numbers in databases, API communications, and ensuring international compatibility across telecommunications systems.
Can you port phone numbers between carriers in Puerto Rico?
Yes, number portability is available in Puerto Rico under FCC wireless local number portability (WLNP) regulations. You can transfer your Puerto Rico phone number (787 or 939) between wireless carriers and between wireless and landline services. The process typically takes 2.5 hours for wireless-to-wireless ports and several days for wireline-to-wireless ports. You must have an active account with matching name/address information. While carriers cannot refuse porting due to outstanding balances, you remain obligated to pay any early termination fees or final bills.
Porting costs and requirements:
How do I validate a Puerto Rico phone number with regex?
Use this regex pattern to validate Puerto Rico phone numbers in E.164 format:
^\+1(787|939)[2-9]\d{6}$. This pattern matches +1, followed by area code 787 or 939, then a digit from 2-9 (exchange codes can't start with 0 or 1), and finally 6 more digits.Regex patterns for multiple formats:
For production use, sanitize input first by removing all formatting characters, then apply the strict E.164 regex.
Are Puerto Rico phone numbers considered international?
No, Puerto Rico phone numbers are not considered international from the United States perspective. Puerto Rico is a U.S. Commonwealth and part of the NANP. Calls between Puerto Rico and the mainland U.S. are treated as domestic calls with no international rates or dialing codes required.
Important billing considerations: While technically domestic, some U.S. carriers treat calls to Puerto Rico as international or charge higher rates than mainland calls. Mobile carrier policies vary:
Always verify with your specific carrier to understand billing practices for Puerto Rico calls and data usage.
What regulatory body oversees telecommunications in Puerto Rico?
The Puerto Rico Telecommunications Regulatory Board (PRTRB) oversees telecommunications in Puerto Rico, working in conjunction with the Federal Communications Commission (FCC). The PRTRB handles local regulatory matters including service quality standards, consumer protection, rate regulation, and compliance enforcement, while adhering to federal FCC regulations that apply to all U.S. territories. Telecommunications providers must maintain compliance with both PRTRB local requirements and FCC federal mandates.
Key PRTRB responsibilities:
Contact information:
How do mobile and landline numbers differ in Puerto Rico?
Puerto Rico mobile and landline numbers use the same format and area codes (787 and 939). Unlike many countries, you cannot distinguish between mobile and landline numbers by their format alone. Both number types follow the standard NANP format: +1 (787/939) XXX-XXXX. This is consistent throughout the NANP, where mobile numbers are not allocated separate prefixes.
Carrier identification methods:
These methods require API integration with telecom database providers and typically incur per-query charges.
What disaster recovery considerations apply to Puerto Rico telecom systems?
Puerto Rico's hurricane-prone location requires robust disaster recovery planning. Implement redundant routing paths, maintain 72+ hours of backup power (UPS + generators + fuel reserves), distribute processing centers geographically (primary in PR, secondary on mainland U.S., tertiary in distant region), and establish automated failover systems (RTO <30 seconds). Hurricane Maria in 2017 caused prolonged telecommunications outages lasting months in some areas, highlighting the critical need for resilience in Puerto Rico's telecom infrastructure.
Critical RTO/RPO targets:
Summary: Implementing Puerto Rico Phone Numbers in Your Application
This guide has provided you with a comprehensive understanding of Puerto Rican phone numbers, from their format and validation to portability and disaster recovery considerations. By following the best practices and recommendations outlined here, you can ensure your applications handle these numbers accurately, reliably, and resiliently.
Key takeaways for Puerto Rico phone number integration:
Next steps and additional resources:
Implementation checklist:
Stay updated on any regulatory changes from the PRTRB and FCC, and adapt your systems accordingly.