CDN
Every flag is on cdn.countryflags.org, free, with no key. The code is the ISO 3166-1 alpha-2 code in lower case, and xk for Kosovo.
Addresses
| SVG | https://cdn.countryflags.org/{code}.svg |
|---|---|
| PNG | https://cdn.countryflags.org/w{width}/{code}.png |
| WebP | https://cdn.countryflags.org/w{width}/{code}.webp |
| AVIF | https://cdn.countryflags.org/w{width}/{code}.avif |
| ICO | https://cdn.countryflags.org/{code}.ico, 16, 32 and 48 px |
Widths: 40, 80, 160, 320, 640, 1280, 2560. The height follows the flag's own proportions.
Example
<img src="https://cdn.countryflags.org/w320/de.webp" width="320" height="192" alt="Flag of Germany"> Caching
Browsers keep a file for a year. Every file is sent with Access-Control-Allow-Origin: *, so a page on any site can draw it on a canvas.