phone number standards
phone number standards
Latvia Phone Numbers: +371 Format, Validation & Area Codes
Complete guide to Latvia phone numbers including +371 country code, 8-digit format, validation code, number portability, and mobile operators (LMT, Tele2, Bite). Implement Latvian number formatting with our developer guide.
Latvia Phone Numbers: +371 Format, Validation & Area Codes
Latvia uses a streamlined 8-digit phone number format with the +371 country code. This guide covers everything you need to integrate Latvian phone numbers into your application: format validation, number portability rules, mobile and fixed-line distinctions, and implementation best practices. Use this guide whether you're building a contact form, authentication system, or telecommunications application to handle Latvia's closed numbering system regulated by SPRK (Public Utilities Commission).
Understanding Latvian phone numbers is essential for developers working with Baltic telecommunications systems, alongside Lithuanian phone numbers and Estonian phone numbers.
Latvia Phone Number Format: Understanding the 8-Digit System
Latvia uses an 8-digit closed numbering system regulated by the Public Utilities Commission (SPRK) and the Electronic Communications Office. Cabinet of Ministers Regulations No. 684 (adopted August 25, 2008) govern the number format, structure, usage purposes, and dialing procedures.
The closed system eliminates traditional area codes. Dial all numbers nationally using 8 digits, regardless of whether you're calling a fixed line or mobile phone. For international calls, add the country code +371 before the 8-digit number.
National dialing: XXXXXXXX (8 digits)
International dialing: +371 XXXXXXXX
Outbound international prefix: 00 (when calling from Latvia)
Latvia Number Types by First Digit
Latvian phone numbers use their first digit to indicate service type:
| First Digit(s) | Type | Format | Example | Portability | Notes |
|---|---|---|---|---|---|
| 2 | Mobile | 2XXXXXXX | +371 21234567 | Not portable | Largest market segment with three major operators |
| 6 | Fixed Line | 6XXXXXXX | +371 61234567 | Portable | Declining penetration but exceptional fiber coverage |
| 80 | Toll-Free | 80XXXXXX | +371 80012345 | N/A | Free for callers, cost borne by recipient |
| 81 | Shared Cost | 81XXXXXX | +371 81012345 | N/A | Split cost between caller and recipient |
| 90 | Premium Rate | 90XXXXXX | +371 90012345 | N/A | Higher charges for caller, often entertainment services |
Note: First digits 3, 4, 5, and 7 are currently unallocated and reserved for future use.
The following diagram illustrates the structure:
graph TD
A[Latvian Phone Number (+371)] --> B[8-digit Number]
B --> C[2XXXXXXX: Mobile]
B --> D[6XXXXXXX: Fixed Line]
B --> E[80XXXXXX: Toll-Free]
B --> F[90XXXXXX: Premium Rate]
B --> G[81XXXXXX: Shared Cost]How to Validate Latvia Phone Numbers
Validate Latvian phone numbers in your application using regular expressions to ensure correct formatting.
const validateLatvianNumber = (number, type) => {
const patterns = {
mobile: /^2\d{7}$/,
fixed: /^6\d{7}$/,
tollFree: /^80\d{6}$/,
premium: /^90\d{6}$/,
shared: /^81\d{6}$/,
any: /^(?:2|6|80|81|90)\d{6,7}$/
};
// Remove the country code and any non-digit characters
const cleanedNumber = number.replace(/^\+371/, '').replace(/\D/g, '');
// If no type specified, validate against any valid Latvian number
const pattern = patterns[type] || patterns.any;
return pattern.test(cleanedNumber);
};
// Example usage:
console.log(validateLatvianNumber('+371 21234567', 'mobile')); // true
console.log(validateLatvianNumber('61234567', 'fixed')); // true
console.log(validateLatvianNumber('+371 80012345', 'tollFree')); // true
console.log(validateLatvianNumber('9001234', 'premium')); // false – invalid length
// Validate without specifying type
console.log(validateLatvianNumber('+371-21-234-567')); // true – accepts any valid formatHandle these common input formats:
- With country code:
+371 21234567 - Without country code:
21234567 - With formatting:
+371-21-234-567or+371 (21) 234567 - With spaces:
+371 2 123 4567
E.164 Formatting for International Calls
Use E.164 format (+371XXXXXXXX) when storing or transmitting Latvian phone numbers. E.164 is the international standard that ensures compatibility with global telecommunications systems, SMS gateways, and voice APIs. Most telephony APIs (Twilio, Plivo, MessageBird) require E.164 format.
const formatInternational = (number) => {
// Remove existing country code and non-digit characters
const cleanedNumber = number.replace(/^\+371/, '').replace(/\D/g, '');
// Validate before formatting
if (!/^(?:2|6|80|81|90)\d{6,7}$/.test(cleanedNumber)) {
throw new Error('Invalid Latvian phone number format');
}
return `+371${cleanedNumber}`;
};
const formatDisplay = (number) => {
// Convert to E.164 first
const e164 = formatInternational(number);
const digits = e164.replace(/^\+371/, '');
// Format for display: +371 XX XXX XXX
return `+371 ${digits.slice(0, 2)} ${digits.slice(2, 5)} ${digits.slice(5)}`;
};
// Example usage:
console.log(formatInternational('21234567')); // +37121234567
console.log(formatDisplay('21234567')); // +371 21 234 567
console.log(formatDisplay('+371-61-234-567')); // +371 61 234 567Latvia Mobile Operators and Fixed-Line Providers
Latvia's telecommunications market features three major mobile operators and one dominant fixed-line provider:
| Operator | Type | Market Share | Coverage/Performance | Notes |
|---|---|---|---|---|
| LMT | Mobile | ~40% (2024) | Extensive rural coverage, 5G pioneer | Market leader, EIB-funded 5G rollout |
| Tele2 | Mobile | ~30% (2024) | 90% 5G coverage, 104.18 Mbps avg. | Competitive pricing, urban strength, €20M 2024 investment |
| Bite Latvija | Mobile | ~20% (2024) | 91.63 Mbps avg. (July 2024–2025) | Focus on data services and roaming |
| TET | Fixed Line | Dominant | 530,000+ households (72%), 13,400+ km fiber | Formerly Lattelecom, backbone of digital economy |
Mobile Virtual Network Operators (MVNOs): Latvia has several MVNOs operating on the three major networks, including Amigo and others offering budget prepaid services.
Operator identification: The second digit in mobile numbers typically indicates the operator, though number portability complicates this. Implement real-time operator lookup if accurate routing is critical for your application.
Best Practices for Implementation
Number Portability in Latvia
Number portability in Latvia follows a recipient-led process regulated by SPRK. Only fixed-line numbers (6XXXXXXX) are portable – mobile numbers (2XXXXXXX) are not currently portable.
Porting timeline: The standard porting window is 1 business day for consumer requests and up to 3 business days for business lines, though SPRK aims to reduce this further.
Implement real-time number portability lookups for fixed-line numbers to ensure accurate routing. Cache lookup results with an appropriate Time-To-Live (TTL) of 24–48 hours to balance performance and accuracy. Include robust error handling for timeout scenarios.
const lookupPortability = async (number) => {
// Clean the number
const cleanedNumber = number.replace(/^\+371/, '').replace(/\D/g, '');
// Only fixed-line numbers are portable
if (!cleanedNumber.startsWith('6')) {
return { portable: false, reason: 'Mobile numbers are not portable' };
}
try {
// Implement your portability lookup API call here
const response = await fetch(`https://portability-api.example.com/lookup/${cleanedNumber}`, {
timeout: 3000
});
if (!response.ok) {
throw new Error('Lookup failed');
}
const data = await response.json();
return { portable: true, currentOperator: data.operator };
} catch (error) {
console.error('Portability lookup failed:', error);
// Fallback to cached data or default routing
return { portable: true, currentOperator: 'unknown', cached: true };
}
};Error Management
Include comprehensive error handling in your code. Provide clear error messages that specify what went wrong and how to fix it. Log errors for analysis and monitoring.
Latvia-specific error scenarios:
const validateWithErrors = (number) => {
const cleanedNumber = number.replace(/^\+371/, '').replace(/\D/g, '');
if (cleanedNumber.length !== 8) {
return {
valid: false,
error: 'Latvian phone numbers must be exactly 8 digits. You entered ' + cleanedNumber.length + ' digits.'
};
}
const firstDigit = cleanedNumber[0];
const firstTwoDigits = cleanedNumber.slice(0, 2);
if (!['2', '6'].includes(firstDigit) && !['80', '81', '90'].includes(firstTwoDigits)) {
return {
valid: false,
error: 'Latvian numbers must start with 2 (mobile), 6 (fixed), 80 (toll-free), 81 (shared cost), or 90 (premium).'
};
}
if (firstDigit === '2' && cleanedNumber.length === 8) {
return { valid: true, type: 'mobile' };
}
if (firstDigit === '6' && cleanedNumber.length === 8) {
return { valid: true, type: 'fixed' };
}
if (['80', '81', '90'].includes(firstTwoDigits)) {
return { valid: true, type: 'special' };
}
return {
valid: false,
error: 'Invalid Latvian phone number format. Verify the number and try again.'
};
};Regulatory Compliance
Stay compliant with Latvian and EU telecommunications regulations:
Key requirements:
- GDPR compliance: Phone numbers are personal data. Obtain explicit consent before storing or processing Latvian phone numbers. Provide clear opt-out mechanisms.
- Anti-spam regulations: Latvia follows EU ePrivacy Directive. Obtain prior consent for marketing calls/SMS. Maintain a suppression list for opt-outs.
- Data retention: Limit retention to what's necessary for your service. Document your legal basis for processing.
- Emergency services: Ensure your system can route emergency calls to 112 (EU-wide emergency number).
Compliance checklist:
- Obtain and document user consent for phone number collection
- Implement opt-in for marketing communications
- Provide clear opt-out mechanism
- Store numbers securely with encryption
- Limit data retention to necessary period
- Enable 112 emergency calling if applicable
- Display clear privacy policy
Visit sprk.gov.lv for current technical specifications and requirements. Access the national numbering plan through the Ministry of Environmental Protection and Regional Development.
Latvia Telecommunications Infrastructure
Latvia operates a modern telecommunications infrastructure with exceptional fiber coverage:
| Metric | Latvia | EU Average | Notes |
|---|---|---|---|
| 4G Coverage | 98% population | ~95% | Near-universal coverage |
| 5G Coverage | 53.1% population | 89.3% | Rapid expansion underway, Tele2 leads with 90% territorial coverage |
| FTTP (Fiber) | 91% households | 56% | 2nd in Europe for rural fiber, 530,000+ households covered |
| VHCN Coverage | 92% households | 73% | Very High Capacity Networks |
| Fiber Subscriptions | 76% of fixed | ~43% | Over 38% deliver 300+ Mbps |
5G spectrum allocation: Services operate on 700 MHz, 800 MHz, 1800 MHz, 3.5 GHz, 3.6 GHz, and 26 GHz bands. Spectrum licenses are valid through December 31, 2043.
EU compliance: Latvia implemented the European Electronic Communications Code (EECC), ensuring interoperability and cross-border compatibility.
Developer implications: Latvia's robust infrastructure supports high-quality VoIP, video calling, and real-time communications. Expect low latency and high reliability, especially in urban and suburban areas.
Frequently Asked Questions
What is Latvia's country code?
The country code for Latvia is +371. Add this prefix before the 8-digit national number for all international calls to Latvia.
Does Latvia have area codes?
No, Latvia uses a closed numbering system without traditional area codes. All phone numbers are 8 digits, and you dial them the same way throughout the country.
How do I validate a Latvian mobile number?
Latvia mobile numbers start with 2 and contain 8 digits total (format: 2XXXXXXX). Use the pattern /^2\d{7}$/ to validate the national number, or /^\+3712\d{7}$/ for the international format.
Are Latvian phone numbers portable?
Only fixed-line numbers (starting with 6) are portable in Latvia. Mobile numbers (starting with 2) are not currently portable. Number portability follows a recipient-led process regulated by SPRK, with porting typically completed within 1–3 business days.
What format should I use to store Latvian phone numbers?
Store Latvia phone numbers in E.164 format: +371XXXXXXXX (country code +371 followed by the 8-digit national number). This ensures compatibility with international telecommunications systems and telephony APIs.
How many digits are in a Latvian phone number?
Latvia phone numbers contain 8 digits nationally, or 11 digits internationally when you include the +371 country code (plus sign, 3 digits for country code, and 8 digits for the number).
Who regulates telecommunications in Latvia?
The Public Utilities Commission (SPRK) and the Electronic Communications Office regulate Latvia's telecommunications sector. Cabinet of Ministers Regulations No. 684 (2008) govern the numbering plan.
What's the difference between Latvian mobile and fixed-line numbers?
Mobile numbers start with 2 (2XXXXXXX), while fixed-line numbers start with 6 (6XXXXXXX). Mobile numbers are not portable, but fixed-line numbers can be ported between operators. Both use the same 8-digit format.
What is the emergency number in Latvia?
Dial 112 for all emergencies (police, fire, ambulance) in Latvia. This is the EU-wide emergency number and works from any phone, including mobile phones without a SIM card.
Can I send SMS to all Latvian number types?
You can send SMS to mobile numbers (2XXXXXXX) and most fixed-line numbers (6XXXXXXX) if they support SMS. Standard SMS character limit is 160 characters (GSM-7 encoding) or 70 characters (Unicode). Toll-free, shared cost, and premium numbers may not support SMS – check with your provider.
Does Latvia support VoIP and virtual numbers?
Yes, Latvia supports VoIP services and virtual numbers. Virtual numbers may use various formats depending on the provider. Ensure your application validates both traditional and VoIP numbers appropriately.
Next Steps
Integrate Latvian phone numbers into your application using the validation patterns and formatting functions provided in this guide. Visit sprk.gov.lv for the latest regulatory updates and technical specifications.