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.
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 imageInstall the package. It contains only JSON and SVG files.
npm install country-flag-emoji-jsonconst flags = require('country-flag-emoji-json');import flags from 'country-flag-emoji-json' with { type: 'json' };Show a flag as an image. It looks the same on every system, Windows included.
<img
src="https://cdn.jsdelivr.net/npm/country-flag-emoji-json@3.0.0/dist/images/DE.svg"
alt="Flag of Germany"
width="32"
height="32"
>Files#
Everything is in the dist folder of the package. The URLs below use jsDelivr. The same files are on unpkg.
| File | URL |
|---|---|
index.jsonAn array of all flags. | |
by-code.jsonAn object of all flags, keyed by code. | |
images/{CODE}.svgOne SVG image per flag, such as images/DE.svg. |
[
{
"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"
}
]{
"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.
| Field | Example | Description |
|---|---|---|
| name | Germany | Name of the country or region, from Unicode CLDR. |
| code | DE | ISO 3166-1 alpha-2 code. See special codes for the exceptions. |
| emoji | ๐ฉ๐ช | The flag emoji. |
| unicode | U+1F1E9 U+1F1EA | Code points of the emoji, separated by spaces. |
| image | โฆ/images/DE.svg | jsDelivr URL of the SVG image. |
Special codes#
Most codes are ISO 3166-1 alpha-2 country codes. These ones are not.
| Code | Flag |
|---|---|
| GB-ENG, GB-SCT, GB-WLS | England, Scotland and Wales. These are ISO 3166-2 subdivision codes. |
| AC, CP, CQ, DG, EA, IC, TA | Ascension Island, Clipperton Island, Sark, Diego Garcia, Ceuta & Melilla, Canary Islands, Tristan da Cunha. ISO reserves these codes. |
| EU, UN | European Union and United Nations. ISO reserves these codes. |
| XK | Kosovo. 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
Use the SVG image
Show the
imageURL in an<img>tag. It looks the same on every system. This is the most reliable fix. - 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.
Terminalnpm install country-flag-emoji-polyfillJavaScriptimport { polyfillCountryFlagEmojis } from 'country-flag-emoji-polyfill'; polyfillCountryFlagEmojis();CSSbody { 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.
| Flag | v2 code | v3 code |
|---|---|---|
| England | ENGLAND | GB-ENG |
| Scotland | SCOTLAND | GB-SCT |
| Wales | WALES | GB-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.
No flags found
Try a country name, a code such as DE, or paste an emoji.