Free Country Flags

Free SVG and PNG flags for all 249 countries and territories, in four designs, ready to hotlink from our CDN.

Flag of

ISO 3166-1 code

Design

Format

Image URL
HTML
Markdown
Open file

Hotlink any flag with one URL

Every flag lives at a predictable address, built from the design, the lowercase ISO 3166-1 alpha-2 country code and the format:

https://cdn.ipregistry.co/flags/{design}/{code}.{svg|png}

So the French flag in the Twemoji design is https://cdn.ipregistry.co/flags/twemoji/fr.svg, and you can use it like any other image:

<img src="https://cdn.ipregistry.co/flags/twemoji/fr.svg" alt="Flag of France" height="32">

Files are served from Cloudflare's edge with a 30-day cache header and CORS enabled, so they load fast wherever your users are and work from JavaScript too. There is nothing to sign up for.

Four flag designs

PNG files are 128 pixels on their longest side. Noto has no flag for five territories (Bouvet Island, Heard Island and McDonald Islands, Saint Martin, Svalbard and Jan Mayen, U.S. Minor Outlying Islands): pick another design for those.

Show each visitor the flag of their country

Matching a visitor to a flag starts with knowing where they are. The Ipregistry API geolocates an IP address and returns the flag with the country, as an emoji and as a URL for each design:

"flag": {
  "emoji": "🇫🇷",
  "emoji_unicode": "U+1F1EB U+1F1F7",
  "emojitwo": "https://cdn.ipregistry.co/flags/emojitwo/fr.svg",
  "noto": "https://cdn.ipregistry.co/flags/noto/fr.png",
  "twemoji": "https://cdn.ipregistry.co/flags/twemoji/fr.svg",
  "wikimedia": "https://cdn.ipregistry.co/flags/wikimedia/fr.svg"
}

A call from the browser without an IP address looks up the visitor itself, so one request is enough to put the right flag next to a phone number field, a currency picker or a language menu:

const response = await fetch('https://api.ipregistry.co/?key=YOUR_KEY&fields=location.country');
const { location } = await response.json();
document.querySelector('#flag').src = location.country.flag.twemoji;

The same response carries the country name, calling code, languages and much more, all listed in the field reference. You get 20,000 free lookups to get started.

FAQ

Frequently asked questions

Are these country flags free to use?

Yes. All 249 flags are free to download or hotlink, for personal and commercial projects. The Wikimedia designs are national flags, which are generally in the public domain, although some countries restrict how their flag or coat of arms may be used.

Twemoji and Emojitwo are under CC BY 4.0, so credit them somewhere on your site or in your app's about screen. Noto is under the Apache 2.0 license.

Can I hotlink the flag images?

Yes, that is what the CDN is for. Every file is sent with a 30-day cache header and with CORS enabled, so you can put the URL straight into an img tag, a CSS background or a fetch call without copying files to your own server.

Which country codes are supported?

Files are named after the lowercase two-letter ISO 3166-1 alpha-2 code: fr for France, gb for the United Kingdom, us for the United States. All 249 officially assigned codes are covered, territories included. Codes outside the standard, such as eu or uk, return a 404.

Which formats and sizes are available?

Wikimedia, Twemoji and Emojitwo flags come as SVG and PNG. Noto flags come as PNG only. SVG files scale to any size without losing quality, so prefer them when you can.

PNG files are 128 pixels on their longest side: Twemoji, Noto and Emojitwo flags are 128 by 128, and Wikimedia flags keep the official proportions of each country, for example 128 by 67 for the United States.

How do I show the flag of a visitor's country?

Look up the visitor's IP address with the Ipregistry API. The response includes location.country.flag with the emoji and a ready-made URL for each of the four designs, so you never have to map countries to files yourself.

Try different tools

Explore all