What the random flag generator does
Press one button and a country's flag appears, drawn large, with the country's name under it. That is the whole tool. There is no quiz to finish before you see a flag, no account, and no wheel that spins for four seconds before landing on an answer the page already picked.
By default the draw covers the 195 sovereign states — the 193 UN member states plus the Holy See and Palestine. Switch on Include territories and it widens to all 249 officially assigned ISO 3166-1 alpha-2 codes, which adds Puerto Rico, Greenland, Guam, Åland and 50 others. Ask for anything from 1 to 20 flags at a time. A batch never repeats a country inside itself.
A draw of six from the default pool looks like this:
Sudan (SD) · Croatia (HR) · Latvia (LV) · Kenya (KE) · Georgia (GE) · Djibouti (DJ)
Six flags, six large images, six names. On the page you see the flags themselves — this paragraph prints the country codes instead, for exactly the reason explained further down.
Teachers use it to open a lesson. Pub quiz hosts use it to build a round. Designers grab it for a colour reference. Developers pull a plausible country for a test fixture. It works the same for all of them, because there is only one thing it does.
Why draw a flag at random instead of picking one
People are bad at being random, and predictably bad. Ask a room to name a country and you get France, Japan, Brazil, Canada — the flags everyone can already draw from memory. Ask the same room twice and you get the same four. A quiz built that way tests nothing, and a lesson built that way visits the same eight countries all year.
The random flag generator has no favourites. Comoros and Kiribati come up as often as Italy. That is the point of the tool: it hands you the country you would never have chosen, which is the one worth learning.
The other reason is what the alternatives ask of you first. The flag niche splits into two halves and neither does the simple thing. On one side are the quiz sites with excellent flag artwork, where the random draw is buried inside a scored 20-question run with an ad break in the middle — you wanted one flag and got a game. On the other side are the generic list generators, which are fast and batchable but hand back the country's name with no flag at all, or a thumbnail the size of a postage stamp. Then there is the wider pattern: the app that wants an install before it shows you anything, the classroom platform priced per seat where the flag deck is three menus deep, the "free" site whose free tier is a trial clock. Every one of those charges you attention, an install, or a card number before the first flag.
This page charges none of it. Open it, press the button, read the flag, close the tab. If that takes you longer than ten seconds, something is broken and we want to hear about it.
How the random flag generator works
The draw uses crypto.getRandomValues() — your browser's cryptographic random number generator — with rejection sampling on top. Rejection sampling matters more than it sounds. The lazy way to turn a random 32-bit number into a number from 0 to 194 is to take the remainder, and that quietly makes the first few countries in the list slightly likelier than the rest. The bias is small. It is also avoidable, so it is avoided: any number that would land in the uneven tail is thrown away and another is drawn. Every country in the pool is equally likely, every time.
Batches use a partial Fisher–Yates shuffle over the pool, which is what guarantees no duplicates. Drawing Chad twice in a batch of ten is not a fun coincidence, it is a defect — you asked for ten flags and got nine.
The pool itself comes from two external standards, not from anyone's opinion. The 195-state default is UN membership plus the two observer states. The 249-code wide pool is ISO 3166-1 alpha-2, the same list your shipping form and your currency library use. Drawing that boundary from published standards keeps it defensible and keeps us out of the business of editorialising about borders.
Why the flags are images, not emoji
Windows ships no country-flag glyphs. Every flag emoji is really a pair of letters in a special alphabet — the flag of Portugal is the letters P and T — and the font decides whether to draw a flag or the bare letters. Segoe UI Emoji, the emoji font on Windows 10 and 11, contains no country flags, so Chrome and Edge on Windows render PT. That is the most common desktop setup in the world.
On a tool where the flag is the entire answer, that is not a rough edge. So every flag here is an SVG file served from this site — 249 of them, about 2.1 MB on disk, none of it in the JavaScript bundle. Only the flags you actually draw are ever downloaded, and the smallest are under 200 bytes. They render identically on Windows, macOS, Android, a projector at the front of a classroom, and a printout. The emoji still exists in the data, but only as a clipboard payload, never as the display.
The three controls
The random flag generator has three settings and no settings screen. They sit in one row under the button.
| Control | Default | Range | What it changes |
|---|---|---|---|
| How many | 1 | 1–20 | Flags per draw. One renders large; more than one renders a grid. |
| Include territories | Off | On / Off | Off draws from 195 sovereign states. On draws from all 249 ISO codes. |
| Hide the name | Off | On / Off | Replaces each country name with a Reveal button. The flag still shows. |
The button label follows the count, so you always know what you are about to get: Show me a flag at 1, Show me 12 flags at 12. The caption under the controls says which pool you are drawing from — Drawing from the 195 sovereign states, or Drawing from all 249 ISO country and territory codes. No hidden state.
The count field corrects itself rather than arguing with you. Type 0 and you get one flag and the note Minimum is 1 flag. Type 25 and you get 20 with Capped at 20 flags. Type 3.7 and you get 3. Clear the field entirely and you get 1. You never get an error screen, a NaN, or an empty result box.
The cap of 20 is deliberate. Each result is a real image, not a text glyph, and a grid of 40 flags is a slow page and an unreadable one. If you need the whole set in order rather than at random, you want a list of countries, not a randomiser.
Copy is per flag, and it writes the emoji followed by the name — 🇹🇳 Tunisia. The emoji is there because chat apps render it; the name is there because, as above, plenty of places do not. With more than one result a Copy all button appears and joins them with line breaks, so a draw of three pastes as three clean lines into your quiz doc.
Running a guess-the-flag round
The random flag generator has one feature built for this, and it is a small one. Turn on Hide the name. The flag shows at full size and the name is replaced by a Reveal button. Press it when the room has committed to an answer. That is the entire feature — no score, no timer, no streak, no next-question flow you have to sit through. It is an affordance, not a game.
One detail worth knowing if anyone in the room uses a screen reader: while the name is hidden, it is removed from the image's alt text too. Without that, the answer gets read aloud before anyone has guessed. It is the kind of thing that is invisible when it works and ruins the round when it does not.
If you are running this for a class or a party, a few things that hold up in practice. Draw one flag at a time for a slow round with discussion, or a batch of six for a speed round where the grid is the question sheet. Keep territories off for a general audience — Bouvet Island is nobody's idea of a fair question — and turn them on for a geography club that has earned it. And press the button once before you start, so the first flag lands while the room is still settling rather than while everyone is watching you find the button. Space or Enter draws too, so you can run the whole round without looking down at the trackpad.
Where flags get tricky
Some flags are genuinely hard to tell apart, and a random flag generator will find them sooner than you would. Chad and Romania are the famous pair — same blue-yellow-red vertical bands, with Chad's blue a shade darker. Ireland and Ivory Coast are mirror images of each other. Monaco and Indonesia are both a red bar over a white bar, separated in real life by their proportions and a barely different red, which means that at a fixed size on screen they are all but identical. If your answer sheet says "Indonesia" and someone shouts "Monaco", they are not wrong on the evidence in front of them.
There is also the shape question. Nepal's flag is the only non-rectangular national flag in the world, two stacked pennants. Switzerland and the Vatican fly square flags. The artwork here comes from a 4:3 set, so Nepal's pennant is drawn at its true proportions inside a 4:3 frame — it keeps its shape rather than being stretched to fill the box — while the two square flags are drawn in the set's 4:3 variant so the grid stays even. Worth saying out loud if you are teaching the topic, because "which flag is not a rectangle" is a question this tool cannot ask on its own.
Finally, names. Each result shows the common English name — DR Congo, not Democratic Republic of the Congo; Ivory Coast, not Côte d'Ivoire. Short names fit under a flag and are what people actually say. If you need official long-form names for a document, take the flag from here and the wording from the source that document answers to.
Related tools
If you are building a quiz round rather than a single question, the random state generator does the same job for the 50 US states with capitals and regions attached, and the random year generator gives you a year with the facts about it, which pairs well with a flag for a history round. The random emoji generator covers everything except flags on purpose — flags are here because they need image assets that an emoji font cannot be trusted to supply.
For classroom games more generally: random letter generator for Scattergories-style rounds, dice roller for anything turn-based, random name picker for choosing who answers next, and list randomizer when you have your own list and just need it shuffled.
Frequently asked questions
Can I use the flag images in my own project?
The artwork comes from the flag-icons set, which is MIT licensed — so yes, with attribution per that licence. Take it from the source project rather than scraping this page, so you get the whole set and the licence text together. For a slide deck or a worksheet, a screenshot is fine and nobody will mind.
How many flags should I draw at once?
One for a discussion question, since it renders at about 320px and reads from the back of a room. Six to twelve for a grid you can hand out or project as a whole round — twelve fits comfortably on a laptop screen without scrolling. Twenty is the cap, and at twenty each flag is small enough that the fiddly ones get unfair.
Does the territories toggle change how often big countries appear?
Yes, and it is worth understanding before a quiz. With territories off, every draw is one of 195 countries. With it on, the pool is 249 and the extra 54 entries are dependencies and territories — Anguilla, Bermuda, Guam, Åland, Antarctica and so on. Each one is exactly as likely as France. Turn it on for depth, leave it off for a fair general-knowledge round.
Are the flags current?
They reflect the flag-icons set as committed to this site, which tracks the current official designs. Flags do change — countries redesign them, and the emoji and icon sets take time to catch up. If you spot one that is out of date, tell us and we will update the asset. It is one file.
Does anything I do here get sent to a server?
No. The draw runs in your browser. The only network requests are for the flag images you drew, which are static files on this site like any other image. Nothing is logged, nothing is stored, and there is no account to make.
Is there a limit, and does it cost anything?
No limit — press the button as many times as you like — and the random flag generator costs nothing to use. Microapp's annual membership buys an ad-free site and AI-backed tools at near cost; a random draw over 249 SVG files needs neither. Of every dollar Microapp does earn, 10% goes to charity off the top, audited quarterly.
Why does the first load show a placeholder instead of a flag?
Because the page is prerendered as static HTML and the flag is picked in your browser. If a flag were chosen while building the page, everyone would get the same one until the next deploy — and the server's choice and your browser's choice would disagree on the first render. So the display starts with Press the button. and the first draw is genuinely yours.