country-flag-emoji-json

Country flag emojis as JSON

All 262 flag emojis from Unicode 18.0. Each flag has a name, an ISO code, the emoji, its Unicode code points, and an SVG image. Use it from a CDN or install it from npm.

Quick start

Fetch the JSON from jsDelivr. Nothing to install.

JavaScript
const response = await fetch(
  'https://cdn.jsdelivr.net/npm/country-flag-emoji-json@3.0.0/dist/by-code.json'
);
const flags = await response.json();

flags.DE.name;  // "Germany"
flags.DE.emoji; // "๐Ÿ‡ฉ๐Ÿ‡ช"
flags.DE.image; // URL of the SVG image

Files#

Everything is in the dist folder of the package. The URLs below use jsDelivr. The same files are on unpkg.

FileURL
index.json

An array of all flags.

by-code.json

An object of all flags, keyed by code.

images/{CODE}.svg

One SVG image per flag, such as images/DE.svg.

index.json
[
  {
    "name": "Germany",
    "code": "DE",
    "emoji": "๐Ÿ‡ฉ๐Ÿ‡ช",
    "unicode": "U+1F1E9 U+1F1EA",
    "image": "https://cdn.jsdelivr.net/npm/country-flag-emoji-json@3.0.0/dist/images/DE.svg"
  }
]
by-code.json
{
  "DE": {
    "name": "Germany",
    "emoji": "๐Ÿ‡ฉ๐Ÿ‡ช",
    "unicode": "U+1F1E9 U+1F1EA",
    "image": "https://cdn.jsdelivr.net/npm/country-flag-emoji-json@3.0.0/dist/images/DE.svg"
  }
}

Fields#

Each flag has these fields. In by-code.json, the code is the key, so code is left out.

FieldExampleDescription
nameGermanyName of the country or region, from Unicode CLDR.
codeDEISO 3166-1 alpha-2 code. See special codes for the exceptions.
emoji๐Ÿ‡ฉ๐Ÿ‡ชThe flag emoji.
unicodeU+1F1E9 U+1F1EACode points of the emoji, separated by spaces.
imageโ€ฆ/images/DE.svgjsDelivr URL of the SVG image.

Special codes#

Most codes are ISO 3166-1 alpha-2 country codes. These ones are not.

CodeFlag
GB-ENG, GB-SCT, GB-WLSEngland, Scotland and Wales. These are ISO 3166-2 subdivision codes.
AC, CP, CQ, DG, EA, IC, TAAscension Island, Clipperton Island, Sark, Diego Garcia, Ceuta & Melilla, Canary Islands, Tristan da Cunha. ISO reserves these codes.
EU, UNEuropean Union and United Nations. ISO reserves these codes.
XKKosovo. A user-assigned code, used by the EU and others.

Flags on Windows#

Windows has no flag emojis. It shows the two letters of the code instead, so the flag of Germany appears as DE. There are two fixes.

  1. 1

    Use the SVG image

    Show the image URL in an <img> tag. It looks the same on every system. This is the most reliable fix.

  2. 2

    Load a flag font

    country-flag-emoji-polyfill adds a flag font only when the browser needs it. Call it once, then put the font first in your CSS. This site does the same.

    Terminal
    npm install country-flag-emoji-polyfill
    JavaScript
    import { polyfillCountryFlagEmojis } from 'country-flag-emoji-polyfill';
    
    polyfillCountryFlagEmojis();
    CSS
    body {
      font-family: 'Twemoji Country Flags', system-ui, sans-serif;
    }

Upgrading from v2#

There is one breaking change. England, Scotland and Wales now use ISO 3166-2 codes. Their old image files still exist, so old image URLs keep working.

Flagv2 codev3 code
EnglandENGLANDGB-ENG
ScotlandSCOTLANDGB-SCT
WalesWALESGB-WLS

Other changes in v3:

  • New flag: Sark (CQ).
  • Names follow Unicode 18.0. For example, Turkey is now Tรผrkiye.
  • Images are from OpenMoji 17.

License#

Flag data comes from Unicode 18.0 and CLDR. Images are from OpenMoji. The package and images are licensed under CC BY-SA 4.0. Made by Risan Bagja Pradana, source on GitHub.

All flags 262

Click a flag to copy its emoji, code, Unicode, image URL or SVG.

Emoji
Code
Unicode
Image URL
HTML
SVG