Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active December 20, 2023 12:20
Show Gist options
  • Select an option

  • Save henrik/1688572 to your computer and use it in GitHub Desktop.

Select an option

Save henrik/1688572 to your computer and use it in GitHub Desktop.
EU (European Union) country codes, ISO 3166-1 alpha-2. (This Gist is from 2012. Please see comments for updates.)
# Note: VAT identification numbers for Greece use "EL", not "GR".
COUNTRY_CODES_EU = %w[
AT BE BG CY CZ DK EE FI FR DE GR HU IE IT
LV LT LU MT NL PL PT RO SK SI ES SE GB
]
@bradydan

bradydan commented Oct 19, 2021

Copy link
Copy Markdown

@bigghe @plpepin @panoply the UK (GB) is no longer in the EU, sadly. So your lists are not correct.

The list of EU countries is here courtesy of Eurostat, the "statistical office of the European Union"

Also, note that the European Commission does not always use ISO 3166-1 alpha-2 codes, including at the Eurostat link above. As explained on Wikipedia:

The European Commission generally uses ISO 3166-1 alpha-2 codes with two exceptions: EL (not GR) is used to represent Greece, and UK (not GB) is used to represent the United Kingdom.[10] This notwithstanding, the Official Journal of the European Communities specified that GR and GB be used to represent Greece and United Kingdom respectively.[11] For VAT administration purposes, the European Commission uses EL and GB for Greece and the United Kingdom respectively.

So, depending on your use case, you may need to amend and extend the list of standard ISO 3166-1 alpha-2 codes

@panoply

panoply commented Oct 19, 2021

Copy link
Copy Markdown

@bradydan is it official in UK already? I will have peek on the E.U governing sites. I am aware of the EL reference for Greece (I am Greek) however the vast majority of services feed GR when they are US based, might be worth adding EL in any sense. Wikipedia cannot be trusted nowadays, I will look on the gov counterparts and amend where necessary once I can confirm. Thanks for taking the time to leave your comment fam.

@VagishVela

Copy link
Copy Markdown

@bradydan The UK adopted GDPR into the law when they left the EU.

@DanKaplanSES

Copy link
Copy Markdown

I think this is an up to date 2022 list? https://www.defensorum.com/gdpr-countries-list/

@DanKaplanSES

Copy link
Copy Markdown

I asked and answered this stack overflow question to come up with this list which I believe is up to date for 2022: AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, EL, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE, UK

@FredTheDino

FredTheDino commented Dec 20, 2023

Copy link
Copy Markdown

What a helpful thread! The list posted by Dan is almost right - UK is no longer part of the EU.

According to the UK government atleast: https://www.gov.uk/eu-eea
According to the canadian governement from 2013 (so needs modification): https://www23.statcan.gc.ca/imdb/p3VD.pl?Function=getVD&TVD=141329
According to the actual EU: https://european-union.europa.eu/easy-read_en

The alpha 2 code for Greece is GR no EL - which AFIK is not a valid Alpha2 code.
The correct list (with Alpha2 codes) would then be:

AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE

Cheers!

@bradydan

Copy link
Copy Markdown

This thread was originally about EU countries, them @mizterp changed the topic to GDPR countries and it (confusingly) became a mixture of both topics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment