---
title: client.geo.country_code
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/variables/geolocation/client-geo-country-code
---

**Type:** STRING  
**Access:** read-only

**Available in:** all subroutines

Two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1)
country code for the country.

See `client.geo.country_code3` for the corresponding `alpha-3` country code.

## Example

The following VCL fragment uses a two-letter country code to construct
an emoji flag from its corresponding Unicode
[regional indicator symbols](https://en.wikipedia.org/wiki/Regional_Indicator_Symbol):

```vcl
table unicode_ri {
  "A": "%u{1F1E6}", "B": "%u{1F1E7}", "C": "%u{1F1E8}", "D": "%u{1F1E9}",
  "E": "%u{1F1EA}", "F": "%u{1F1EB}", "G": "%u{1F1EC}", "H": "%u{1F1ED}",
  "I": "%u{1F1EE}", "J": "%u{1F1EF}", "K": "%u{1F1F0}", "L": "%u{1F1F1}",
  "M": "%u{1F1F2}", "N": "%u{1F1F3}", "O": "%u{1F1F4}", "P": "%u{1F1F5}",
  "Q": "%u{1F1F6}", "R": "%u{1F1F7}", "S": "%u{1F1F8}", "T": "%u{1F1F9}",
  "U": "%u{1F1FA}", "V": "%u{1F1FB}", "W": "%u{1F1FC}", "X": "%u{1F1FD}",
  "Y": "%u{1F1FE}", "Z": "%u{1F1FF}"
}

set resp.http.X-flag = table.lookup(unicode_ri, substr(client.geo.country_code, 0, 1))
                       table.lookup(unicode_ri, substr(client.geo.country_code, 1, 1));
```

For example, the country code `SE` will produce 🇸🇪 (the Swedish flag).
