ISO Country Code to Unicode Flag in C♯ and JavaScript

, updated 15 March 2021 šŸ”– c-sharp ā²ļø 1 minute to read

āš ļø This post was last updated in 2021, meaning its contents may be outdated.

The Unicode 6.0 spec defines Regional Indicator symbols, which includes a set of flags. Here are the founders of NATO, if your system supports the flag characters (Windows 10 doesn't yet):

šŸ‡§šŸ‡Ŗ šŸ‡ØšŸ‡¦ šŸ‡©šŸ‡° šŸ‡«šŸ‡· šŸ‡®šŸ‡ø šŸ‡®šŸ‡¹ šŸ‡±šŸ‡ŗ šŸ‡³šŸ‡± šŸ‡³šŸ‡“ šŸ‡µšŸ‡¹ šŸ‡¬šŸ‡§ šŸ‡ŗšŸ‡ø

To create a flag, take the country ISO code (for example GB), and offset it to the flags Unicode block.


public static string IsoCountryCodeToFlagEmoji(this string country)
    return string.Concat(country.ToUpper().Select(x => char.ConvertFromUtf32(x + 0x1F1A5)));

string gb = "gb".IsoCountryCodeToFlagEmoji(); // šŸ‡¬šŸ‡§
string fr = "fr".IsoCountryCodeToFlagEmoji(); // šŸ‡«šŸ‡·


function isoCountryCodeToFlagEmoji(country)
   return String.fromCodePoint(...[].map(c => c.charCodeAt() + 0x1F1A5));

let gb = isoCountryCodeToFlagEmoji("gb"); // šŸ‡¬šŸ‡§
let fr = isoCountryCodeToFlagEmoji("fr"); // šŸ‡«šŸ‡·

šŸ·ļø flag unicode iso country code c♯ javascript specification regional indicator symbol nato character windows gb

ā¬…ļø Previous post: Serverless Git LFS for Game Development

āž”ļø Next post: Automating macOS Notarization for UE4

šŸŽ² Random post: Fixing UE5 Chaos Events at Runtime


Please click here to load comments.