Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Complete .NET library for worldwide country data: ISO codes, currencies, languages, regions, borders & translations for 250+ countries.

License

Notifications You must be signed in to change notification settings

nager/Nager.Country

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

247 Commits

Repository files navigation

🌍 Nager.Country – Worldwide Country Information

Nager.Country provides a comprehensive dataset of worldwide country information, designed for developers who need reliable and structured country-related data.

The dataset includes 250 countries and territories with detailed information such as:

  • βœ… Official country names
  • 🌐 ISO 3166 Alpha-2, Alpha-3, and numeric country codes
  • πŸ’± Associated currencies and ISO 4217 currency codes
  • πŸ—£οΈ Official and spoken languages (ISO 639)
  • 🌍 Continent and subregion classification
  • 🌐 Country borders
  • 🌏 Translations in multiple languages

πŸ“¦ Access

You can access the data in two formats:

🎯 Use Cases

Perfect for projects that require up-to-date and standardized country data, such as:

  • International e-commerce systems
  • Travel and booking platforms
  • Localization (i18n) features
  • Data validation and enrichment
  • Geographic analytics and reporting

πŸ“„ Example Country Data (JSON)

Below is a sample JSON structure returned for the country Austria (AT).
This data is available via the NuGet package or as part of the JSON export.

{
 "commonName": "Austria",
 "officialName": "Republic of Austria",
 "nativeName": "Γ–sterreich",
 "translations": [
 {
 "languageCode": "EN",
 "name": "Austria"
 },
 {
 "languageCode": "ES",
 "name": "Austria"
 },
 {
 "languageCode": "FR",
 "name": "Autriche"
 },
 ...
 ],
 "alpha2Code": "AT",
 "alpha3Code": "AUT",
 "numericCode": 40,
 "tld": [
 ".at"
 ],
 "region": "Europe",
 "subRegion": "Western Europe",
 "borderCountries": [
 "CZ",
 "DE",
 "HU",
 "IT",
 "LI",
 "SK",
 "SI",
 "CH"
 ],
 "currencies": [
 {
 "symbol": "€",
 "singular": "euro",
 "plural": "euro",
 "isoCode": "EUR",
 "numericCode": "978",
 "name": "Euro"
 }
 ],
 "callingCodes": [
 "43"
 ]
}

The project is available as NuGet packages for easy integration into any .NET application.

πŸ“š Core Package – Nager.Country

πŸ”— View on NuGet.org β†’

PM> install-package Nager.Country

🌐 Optional Package – Nager.Country.Translation

Provides localized country names (translations in multiple languages).

πŸ”— View on NuGet.org β†’

PM> install-package Nager.Country.Translation

Examples of use

Get all available countries

Retrieve a full list of all 250 countries and territories.

var countryProvider = new CountryProvider();
var countries = countryProvider.GetCountries();

Lookup a country by its English name

Get detailed information by specifying the official English country name.

var countryProvider = new CountryProvider();
var countryInfo = countryProvider.GetCountryByName("Germany");
//countryInfo.Alpha2Code -> DE
//countryInfo.Alpha3Code -> DEU
//countryInfo.NumericCode -> 276
//countryInfo.Region -> Europe
//countryInfo.SubRegion -> WesternEurope
//countryInfo...

Lookup a country by localized name (with translation support)

Enables country name lookup using translations (e.g. "Germania" instead of "Germany").

➑️ Requires the translation package Nager.Country.Translation

var countryProvider = new CountryProvider();
var countryInfo = countryProvider.GetCountryByNameConsiderTranslation("Germania"); // <- Germany
//countryInfo.Alpha2Code -> DE
//countryInfo.Alpha3Code -> DEU
//countryInfo.NumericCode -> 276
//countryInfo.Region -> Europe
//countryInfo.SubRegion -> WesternEurope
//countryInfo...

Get a country's name in a specific language

Translate the official country name into a desired language.

➑️ Requires the translation package Nager.Country.Translation

var translationProvider = new TranslationProvider();
var translatedCountryName = translationProvider.GetCountryTranslatedName(Alpha2Code.DE, LanguageCode.EN);
//translatedCountryName -> Germany

Get all supported languages

List all language codes available for translation purposes. ➑️ Requires the translation package Nager.Country.Translation

var translationProvider = new TranslationProvider();
var languages = translationProvider.GetLanguages();

🌐 Related & Interesting Projects

Here are some useful projects that also provide country-related data, validation, or localization features:

Language Project
* mledoze countries
* umpirsky country-list
* dr5hn countries-states-cities-database
javascript michaelwittig node-i18n-iso-countries
.net anghelvalentin CountryValidator

Sponsor this project

Contributors 13

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /