I need icons for the flags of countries.

  • PNG file format
  • Small sizes such as 32x32 pixels or similar. Consistent size for all flags (even the flags with strange shapes like Nepal, they have to be fit in).
  • Similar to the official flag, not too much styling/shadows/glowing/wind. If there is style, it has to be consistent.
  • Usable in both open source and commercial products

In each answer, embedding a sample icon (for instance UK) would be appreciated.

up vote 9 down vote accepted

There is a Google Internationalization project called Region Flags that structures the Wikipedia data.

This package is a collection of flags for BCP 47 region codes. Most people think of these as country flags, but there are a few codes / flags that do not correspond to countries. The flags are in SVG and PNG format and named by their BCP 47 region code, which for countries is the same as ISO 3166-2 country code.

The license is based on the Wikipedia license, which are flag-dependent

The flags are downloaded from Wikipedia. When Wikipedia flags were copyrighted, we worked we Wikipedia editors to either relicense them, or drew / sourced and uploaded new public-domain versions.

How to get data:

To download missing flags, run download-wp.py.

To update to latest flags from Wikipedia, delete the html, svg, and png directories, then run make-aliases.sh followed by download-wp.py.

Data formats are PNG and SVG, where SVG can be easily and safely be used at any resolution.

enter image description here

  • Glad it was helpful. I use the python-phonenumbers module ( github.com/daviddrysdale/python-phonenumbers ) which it turns out was based on this googlei18n data. Also, I found some nice address parsing modules that I may try to incorporate in my work. – philshem Dec 8 '14 at 12:08

famfamfam icons are free and require no attribution and are quite small:
http://www.famfamfam.com/lab/icons/flags/
enter image description here

EDIT:
The Noun Project has a Flags of the World Collective, although it is not complete, and not in the desired formats of OP, but I just wanted to add them for everyone else who comes through here:
http://thenounproject.com/desbenoit/collection/flags-of-the-world/

EDIT (2):
here's a set of text attributes of world flags, meant for machine learning http://archive.ics.uci.edu/ml/datasets/Flags

  • If you're interested in the famfamfam flags, you may be interested in this follow-up https://github.com/tkrotoff/famfamfam_flags – PatrickT Apr 29 '16 at 15:41

Wikipedia has images for flags of most countries which are normally licensed as Creative Commons and in general National Flags are considered ineligible for copyright as being in the public domain but it is nice to give attibution in your documentation.

Note that usage may be restricted in other ways - e.g. using the German Flag German Flag 200px in a program that promotes racial intolerance would get you into hot water.

Most of the Flags on Wikipedia are available as .png format and are not too stylized but the other problem is that 32x32 px is much to small to represent accurately many national flags, e.g.:

USA 300px USA 300 px --> 32x16 USA 32 px

All the original images come from Wikipedia.

To get such a set I used a python script then ImageMagik mogrify to resize to 32x32, (many ended up not exactly 32x32 as the aspect ratio for most flags is not 1:1), the resulting file and the python script are both available in my drop box - don't forget to credit Wikipedia and to look at the licence terms there.

  • Thanks! Sorry I forgot to explicit an important requirement: consistent size for the whole series. – Nicolas Raoul Aug 25 '14 at 6:55
  • 3
    @NicolasRaoul I have generated a 32x? set as a tar and put it in my dropbox dropbox.com/s/ntkh90dn5w9x6ro/32_pxFlags.tar?dl=0 hope that helps. – Steve Barnes Aug 25 '14 at 7:50
  • "using the German Flag " any citation for this? – Marian Paździoch Aug 15 '17 at 15:07
  • No direct citation @MarianPaździoch but I have seen several news stories in the past where extremists were being prosecuted for associating the flag with their behaviour. – Steve Barnes Aug 15 '17 at 21:04

You can get a public domain set from the CIA World Fact Book:

https://www.cia.gov/library/publications/the-world-factbook/docs/flagsoftheworld.html

Iconfinder allows you to search for icons, e.g., with "flags country": https://www.iconfinder.com/search/?q=flag+country

There is a large number of different icons in various styles, backgrounds, sizes, styles, formats, and licenses.

See a specific example here: https://www.iconfinder.com/icons/2176510/belgium_country_flag_icon#size=256

The results can be filtered by license (eg. "For commercial use").

For an app we made we used flags from Emoji characters. These means you take the ISO country code and map it to the emoji character. Because it's Unicode, you can scale it to any size and then render it as any image format (for example, with ImageMagick)

I'm sure with a more comprehensive search you'll find packages for any and every programming language, but here are a couple packages

note, I haven't checked or used either

  • So, this means the data comes from the font you are using, right? If so, can you recommend an open font that has nice scalable flags? Thanks! – Nicolas Raoul Nov 21 at 8:21
  • here's a partial answer superuser.com/a/1266892/442118 and the question has other resources – philshem Nov 21 at 11:56
  • You should write that font's name/URL/license into your answer, you know what we say about external links :-) The open data that your solution proposes comes directly (or indirectly via the 3 libraries you suggest) from the font. On some systems, the image returned by these 3 libraries might not be open data at all. – Nicolas Raoul Nov 22 at 1:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.