Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know of a list of countries with their associated official language codes? I haven't found anything by Googling yet.

What I'm looking for is something like this:

Country name/code              Language code
Bulgaria (BG)                  bg
Belgium (BE)                   nl, fr

Some further clarifications:

How is there not a correlation between a country and its official language(s)?

In my application this is relevant because I want to redirect someone who accesses it from the US to ${path}/us/en/, so I need to get the official language tag. I get the country code from a geolocation web service and I need the associated (official) language code.

For example, I have everything on my computer set to english, but I live in Romania. When I access it I don't want to get redirected to the UK version, ro/en does not exist, so I want ro/ro.

I wanted to see if there was an already aggregated list so that I wouldn't have to do it manually. If there isn't, I'll build one :).

share|improve this question
This isn't really a question about GIS. – Sean Jun 28 '11 at 13:20
See… – Sean Jun 28 '11 at 13:29
up vote 19 down vote accepted

The countryInfo file from ( has names, country codes, languages and lots of other info. It is a tab separated list so awk or any text editor will let you select just the columns you need.

share|improve this answer
+1 just for the reference to AWK! – whuber Jun 28 '11 at 13:25
Seems to be too good to be true, is there any catch? – Mahn May 8 '15 at 18:15
No catch, just open data – iant May 8 '15 at 18:18

The information you are looking for is actually 2 separate pieces of information. I am not sure there is a direct correlation between the two.

Country codes are available at:

And language codes are available at:

Mixing the pieces of information together is something done in "locales". This seems to be something that is not real standardized. Lots of companies appear to be doing it on their own and even providing utilities for supporting this in things like Java (See

This site has more information on language tags:

BTW, the relationship of country codes to language code is not usually that meaningful in a user application. There are lots of users in a country that use "non-native" languages. (IE: someone in the U.S. that uses Chinese, or vice-versa.)

share|improve this answer

Searching Stack Overflow for "locale list" resulted in this:

Throw one of those lists into your Favorite Programming Language and then you can make a table like what you want.

share|improve this answer

Codes arranged alphabetically by alpha-3/ISO 639-2 Code

via google> wiki> external site

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.