What “Country Code” Can Mean
There are three common types of country codes, and each serves a different purpose.
1. ISO Country Codes (ISO 3166-1)
Standardized by the ISO, these codes are widely used in APIs, databases, and international systems.
|
Format
|
Example
|
Used For
|
|
Alpha-2
|
US, GB, DE
|
APIs, forms, localization
|
|
Alpha-3
|
USA, GBR, DEU
|
Shipping, reporting
|
|
Numeric
|
840 (US), 276 (Germany)
|
Legacy databases, trade compliance
|
Use ISO codes when saving country information in structured data. For more context on IP-based country detection, see Introduction to IPstack: The Basics of IP Geolocation.
2. Country Calling Codes (Phone Dialing Codes)
Used for international phone dialing and SMS routing.
|
Country
|
Calling Code
|
|
United States
|
+1
|
|
United Kingdom
|
+44
|
|
Australia
|
+61
|
|
India
|
+91
|
Use calling codes when collecting or validating international phone numbers.
3. ISO Numeric Country Codes
These three-digit codes are used in legacy systems or standardized government reports.
Examples:
- United States: 840
- Canada: 124
- Germany: 276
Only use numeric codes when required by your data system or regulations.
What “Region Code” Usually Means

A region code represents a subdivision within a country, such as a state, province, or administrative region.
U.S. State Codes (Region Codes)
|
State
|
Code
|
|
California
|
CA
|
|
New York
|
NY
|
|
Texas
|
TX
|
|
Florida
|
FL
|
These are often used with ISO 3166-2 for full country-region identifiers:
- US-CA = United States – California
- CA-ON = Canada – Ontario
- AU-NSW = Australia – New South Wales
Use region codes for state/province fields, analytics, and shipping forms. If you’re building a mobile or location-aware app, see Build a Mobile Geolocation App with React Native and IPstack for implementation ideas.
Most Common Confusions (And Fixes)
|
Mistake
|
Why It’s Wrong
|
Correct Usage
|
|
Using +1 as a country code
|
That’s a calling code, not ISO
|
Use US
|
|
Using US as a state code
|
US is the country, not a state
|
Use CA, TX, NY, etc.
|
|
Storing full country names
|
Leads to inconsistent data
|
Use ISO codes: US, GB, etc.
|
|
Combining country and region in one field
|
Breaks data structure
|
Use separate fields or ISO 3166-2
|
Which One Should You Use? (Decision Table)
|
Use Case
|
Recommended Code Type
|
Example
|
|
Collecting phone numbers
|
Country calling code
|
+1, +44, +91
|
|
Storing country in a database
|
ISO Alpha-2
|
US, GB, IN
|
|
Saving region/state info
|
Region code or ISO 3166-2
|
CA, TX, US-NY
|
|
Segmenting analytics by location
|
ISO + Region Code
|
US, US-CA
|
|
Content personalization
|
ISO + Region
|
GB-ENG, US-CA
|
|
Compliance/legacy datasets
|
ISO numeric
|
840, 276, 124
|
Examples (Real-World Use Cases)
- Country dropdown → ISO Alpha-2: US, CA, GB
- State dropdown → Region code: TX, ON, NSW
To explore geolocation tools, visit 5 Best Free Geolocation APIs In 2026.
CRM / Shipping Fields
- Country: US
- State: TX
- ISO 3166-2 combo: US-TX
Analytics Dashboard
- Country-level segments: US, FR, IN
- Region-level: US-NY, CA-QC
- Use IP or dropdown to set calling code: +1, +91
- Store ISO code separately for backend location tracking
To explore more advanced use cases like fraud detection, read Build an AI Agent for Fraud Detection Using Python, Langchain, and IPstack.
Summary: Key Points to Remember
- Use ISO Alpha-2 codes (US, GB) to store country data
- Use calling codes (+1, +44) for phone number inputs
- Use region/state codes (CA, TX) for subdivisions
- Use ISO 3166-2 (US-CA, CA-ON) to represent country + region together
Power Your Location Data with ipstack
ipstack provides:
- ISO country codes
- Region/state codes
- Calling codes
- Timezone, city, and more
Whether you’re building sign-up flows, custom dashboards, or location-aware mobile apps, ipstack delivers fast, reliable IP geolocation via API.