What this tool does
This converter maps ISO 3166-1 alpha-2 country codes to flag emojis and back. Type GB to get 🇬🇧, US to get 🇺🇸, or paste a row of flags to recover their codes. It is useful for building country pickers, localisation tables, social bios, travel content, and anywhere you want to add a flag without hunting through an emoji picker.
How it works
There is no dedicated “flag” code point for each country. Instead, a flag emoji is a pair of Regional Indicator Symbols — a set of 26 Unicode characters at code points U+1F1E6 (🇦) through U+1F1FF (🇿), one for each letter.
To build the flag for a code like GB, the tool emits:
- The indicator for
G(U+1F1EC) - Followed immediately by the indicator for
B(U+1F1E7)
When the rendering engine sees two valid consecutive Regional Indicator Symbols that form an assigned ISO 3166-1 code, it draws the corresponding country flag. The emoji character sequence for the flag has no visible break between the two indicator symbols — they combine at render time.
Decoding reverses the process: the tool walks the string by Unicode code point (not by JavaScript string index, since Regional Indicator characters are astral code points that occupy two UTF-16 code units), and whenever it finds two consecutive indicators, it converts each back to its letter.
ISO 3166-1 alpha-2 codes
These are the two-letter country codes assigned and maintained by ISO and used across international standards including TLDs, currencies (ISO 4217 uses a related scheme), and language tags (BCP 47). Well-known examples:
| Code | Country | Code | Country |
|---|---|---|---|
| GB | United Kingdom | US | United States |
| DE | Germany | FR | France |
| JP | Japan | IN | India |
| BR | Brazil | NG | Nigeria |
| AU | Australia | ZA | South Africa |
Platforms and rendering notes
- Assigned codes render as the country’s flag on platforms with the relevant glyph: most iOS, Android, and macOS emoji sets include virtually all current flags. Windows renders some flags but not all.
- Unassigned combinations like
XXdisplay as two boxed indicator letters (🇽🇽) rather than a flag, because no glyph exists. - Sub-national flags such as England 🏴, Scotland 🏴, and Wales 🏴 use a separate Unicode Tag Sequence encoding — they are not alpha-2 codes and are outside the scope of this tool.
- Codes are case-insensitive:
gb,Gb, andGBall produce the same indicator pair.