Country Codes Reference
ISO 3166 is the international standard for country codes and codes for their subdivisions. This reference provides complete access to all officially recognized country codes with their corresponding flag emojis and regional information.
What are Country Codes?
Country codes are standardized short text codes or numbers used to represent countries and their subdivisions. They're essential for international communication, data exchange, and software development.
Code Types
Alpha-2 (ISO 3166-1 alpha-2)
Two-letter country codes like US, GB, DE
Alpha-3 (ISO 3166-1 alpha-3)
Three-letter country codes like USA, GBR, DEU
Numeric (ISO 3166-1 numeric)
Three-digit numeric codes like 840, 826, 276
Common Use Cases
- Web Development: Country selection in forms, localization, and international shipping
- API Development: Standardized country identification in REST APIs and databases
- Data Analysis: Grouping and filtering data by geographic regions
- E-commerce: Payment processing, tax calculation, and shipping restrictions
- Mobile Apps: Location services, content filtering, and regional features
- Government Systems: Official documentation, immigration, and international treaties
Regional Classifications
Africa
Northern, Eastern, Western, Middle, and Southern African countries
Americas
North America, Central America, South America, and Caribbean
Asia
Eastern, Southern, South-Eastern, Western, and Central Asian countries
Europe
Northern, Western, Eastern, and Southern European countries
Oceania
Australia, New Zealand, Melanesia, Micronesia, and Polynesia
Antarctic
Antarctic territories and research stations
Development Examples
JavaScript/React Example:
// Country selection dropdown const countries = [ { code: 'US', name: 'United States', flag: '🇺🇸' }, { code: 'GB', name: 'United Kingdom', flag: '🇬🇧' }, { code: 'DE', name: 'Germany', flag: '🇩🇪' } ]; // API request with country filter const response = await fetch('/api/users?country=US'); // Validate country code const isValidCountry = (code) => { const validCodes = ['US', 'CA', 'GB', 'DE', 'FR', 'JP']; return validCodes.includes(code.toUpperCase()); };
Database Schema Example:
-- Users table with country codes CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL, country_code CHAR(2) NOT NULL, -- ISO 3166-1 alpha-2 region VARCHAR(50), created_at TIMESTAMP DEFAULT NOW() ); -- Index for efficient country-based queries CREATE INDEX idx_users_country ON users(country_code);
Best Practices
- Use Alpha-2 for Storage: Most efficient for database storage and API responses
- Display Full Names: Always show country names to users, not just codes
- Include Flags: Flag emojis improve user experience in country selection
- Handle Edge Cases: Some territories have special status or disputed recognition
- Keep Updated: Country codes can change due to political events
- Validate Input: Always validate country codes against the official ISO list
Special Considerations
- Kosovo (XK): Not officially in ISO 3166-1 but widely used
- Taiwan (TW): Listed as "Taiwan, Province of China" in ISO standard
- Palestine (PS): Recognized as "Palestine, State of" since 2012
- Brexit Impact: UK codes remain unchanged despite EU departure
- Currency Zones: Some countries share currencies (EUR, USD) across borders
Related Standards
- ISO 3166-2: Codes for subdivisions (states, provinces)
- ISO 4217: Currency codes (USD, EUR, JPY)
- ISO 639: Language codes (en, de, fr)
- UN M.49: Numeric codes for statistical purposes
- FIPS 10-4: Withdrawn US standard, replaced by ISO 3166
💡 Pro Tip
Use this reference tool to quickly find the correct country codes for your applications. The Alpha-2 codes are perfect for APIs and databases, while the flag emojis can enhance your user interface. Always validate user input against the official ISO 3166-1 list!