whatisgithub

What is country-flags?

hampusborgos/country-flags — explained in plain English

Analysis updated 2026-06-26

3,765JavaScriptAudience · developerComplexity · 1/5LicenseSetup · easy

In one sentence

A complete collection of SVG and PNG flag images for every country and territory, organized by standard two-letter ISO country codes, ready to drop into any website or app via npm or direct download.

Mindmap

mindmap
  root((country-flags))
    Content
      SVG flags
      PNG flags
      JSON code map
    PNG Sizes
      100px ready
      250px ready
      1000px ready
    Use Cases
      Country dropdowns
      Data tables
      Region selectors
    Tech Stack
      JavaScript
      SVG
      npm
    Audience
      Web developers
      App builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add country flag icons to a dropdown or form that lets users select their country.

USE CASE 2

Display a flag next to a country name in a data table, dashboard, or map interface.

USE CASE 3

Build a language or region selector for a web app using flag images as visual indicators.

USE CASE 4

Export flags at a custom pixel width by running the included SVG export script.

What is it built with?

JavaScriptSVGPNGnpm

How does it compare?

hampusborgos/country-flagszhw2590582/artplayerbenhowdle89/grade
Stars3,7653,7653,764
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity1/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Available via npm or as a ZIP download, pre-rendered PNGs at 100px, 250px, and 1000px are already included in the repo.

Public domain, national flags are not protected by copyright, so these images can be used freely for any purpose with no restrictions.

So what is it?

This repository is a collection of flag images for every country and territory in the world, provided in both SVG and PNG formats. SVG is a vector format that stays sharp at any size, while PNG is the familiar pixel-based image format used across most websites and apps. Having both means you can pick whichever fits your project. The flags are organized by a standard two-letter country code system (ISO 3166), so finding the right flag is as simple as knowing the code for the country you need. For example, the United States would be "US" and Germany would be "DE". A JSON file is included that maps each code to the country's full name, which is useful for building dropdowns, maps, or any interface that needs to display country names alongside their flags. Accuracy is a stated priority of this project. The maintainers try to match what each country's own laws and regulations describe the flag as looking like, rather than using approximate or stylized versions. The source files originally came from Wikimedia Commons, and the flags are in the public domain since national flags are not protected by copyright. Pre-rendered PNG versions are already included at three widths (100px, 250px, and 1000px), covering most common use cases without any extra steps. If you need a different size, the repository includes a script you can run to export the SVGs at any width you choose. You can install the package through the NPM registry, download the whole repository as a ZIP, or clone it directly from GitHub.

Copy-paste prompts

Prompt 1
Show me how to install the country-flags npm package and display the flag for a specific country using its two-letter ISO code in plain HTML.
Prompt 2
How do I use the country-flags JSON mapping file to build a country dropdown with flag images in JavaScript?
Prompt 3
I need flag images at 64px, show me how to run the export script from the country-flags repo to generate them from SVG.
Prompt 4
How do I render an SVG flag for a user's detected locale in a React component using the country-flags package?

Frequently asked questions

What is country-flags?

A complete collection of SVG and PNG flag images for every country and territory, organized by standard two-letter ISO country codes, ready to drop into any website or app via npm or direct download.

What language is country-flags written in?

Mainly JavaScript. The stack also includes JavaScript, SVG, PNG.

What license does country-flags use?

Public domain, national flags are not protected by copyright, so these images can be used freely for any purpose with no restrictions.

How hard is country-flags to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is country-flags for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.