Skip to content
Address & Location

Random Country Code Generator

Pick random two-letter country codes, each shown with its flag and full country name — handy for realistic test data, geography quizzes and country dropdown mockups.

  • 100% free
  • Runs in your browser
  • No sign-up
  • CSV · JSON · TXT export
Options

Tip: press Enter or Space to generate again.

Ready

What is the Random Country Code Generator?

The Random Country Code Generator returns two-letter country codes in the style of ISO 3166-1 alpha-2, the standard used by web forms, shipping systems, payment platforms and internet domains. Every result shows three pieces of information side by side: the flag, the code and the country name — for example “🇵🇰 PK (Pakistan)” or “🇷🇴 RO (Romania)”.

Two-letter codes look simple, but many are not obvious. DE stands for Germany (Deutschland), CH for Switzerland (Confoederatio Helvetica) and ES for Spain (España). Seeing the code next to the name makes the generator a quick learning tool as well as a data source.

Use the “How many?” field to request anywhere from 1 to 100 codes in one go. Each pick is made independently in your browser with the Web Crypto API, so a code can occasionally repeat in a large batch. Nothing is sent to a server or stored. When you are done, copy the list or export it as CSV, JSON or TXT to drop straight into a spreadsheet, fixture file or quiz.

How to use the Random Country Code Generator

  1. Enter a number from 1 to 100 in How many?.
  2. Press Generate to draw the country codes.
  3. Read each code alongside its flag and country name.
  4. Copy the results or export them as CSV, JSON or TXT.

Popular uses

  • Developers & QA testers — seed country fields, locale switches and shipping rules with varied codes.
  • Teachers — run “guess the country from the code” rounds in geography class.
  • Quiz hosts — create flag and code trivia questions in seconds.
  • Data analysts — build sample datasets with a realistic country column.

Why use RandNow?

  • Instant & unlimited — no sign-up, no daily caps.
  • Private by design — results are generated in your browser, not on our servers.
  • Export-ready — copy, CSV, JSON and TXT downloads built in.
  • Cryptographically random — powered by the Web Crypto API.

Alpha-2, alpha-3 and domains

The ISO 3166-1 standard defines several code sets. Alpha-2 codes such as FR and JP are the most common in software and addresses; alpha-3 codes such as FRA and JPN appear on passports and in sports results. Most country-code top-level domains reuse the alpha-2 code — .fr, .jp, .ng — with a few well-known exceptions such as .uk for the United Kingdom, whose ISO code is GB.

When testing, include codes from every continent to catch layout and sorting issues. Press Generate again for a fresh set — it’s free and unlimited.

Frequently asked questions

What format are the country codes?

They are two-letter codes like the ISO 3166-1 alpha-2 standard, shown with the flag and country name.

How many codes can I generate at once?

Anywhere from 1 to 100 per click.

Can the same code appear twice?

Yes. Each code is picked independently, so repeats can happen, especially in larger batches.

Why is the United Kingdom GB and not UK?

GB is the official ISO code for the United Kingdom; UK is mainly used for its internet domain.

Need random data? Get it now.

Pick any of 144 generators, hit Generate and copy or export the results as CSV, JSON or TXT. No account, no limits, nothing stored.

Start generating — free