Guess the Flag Game Using HTML, CSS and JavaScript with Source Code


Welcome to the captivating world of the "Guess the Flag Game"! Crafted using a blend of HTML, CSS, and JavaScript, this web application invites you on an exciting journey of flag discovery and challenge. With its intuitive interface and dynamic functionality, the game beckons players of all ages to test their knowledge of flags from around the globe. Utilizing the REST Countries API, the game seamlessly fetches random flags, ensuring each round presents a fresh and diverse array of countries to identify.

Embark on a thrilling adventure as you explore the vibrant tapestry of world flags. Engage with the interactive interface, where you'll marvel at the beauty of each flag displayed before you. With a simple input field and a click of a button, immerse yourself in the excitement of guessing the country associated with each flag. Receive instant feedback on your guesses, celebrating your successes and learning from your mistakes. Whether you're a seasoned flag enthusiast or a curious explorer, the "Guess the Flag Game" promises hours of entertainment and discovery. Are you ready to unlock the mysteries of flags from every corner of the globe? Join us and let the adventure begin!

You may also check this simple HTML, CSS and JavaScript projects:


  1. Random Flag Generation: The game fetches random flags from the REST Countries API, ensuring each round presents a unique challenge.
  2. Interactive Interface: With a user-friendly interface, players can easily input their guesses and receive immediate feedback on their accuracy.
  3. Real-Time Feedback: After submitting a guess, players receive instant feedback indicating whether their answer is correct or incorrect.
  4. Responsive Design: The application is designed to work seamlessly across various devices and screen sizes, allowing users to enjoy the game on desktops, laptops, tablets, and smartphones.

Technologies Used:

  1. HTML: Provides the structure and content of the web page, including elements such as headings, images, input fields, and buttons.
  2. CSS: Styles the appearance and layout of the application, including background colors, fonts, button styles, and container dimensions.
  3. JavaScript: Enables dynamic interaction and functionality within the game, including flag generation, user input validation, and result feedback.
  4. REST Countries API: Used to retrieve data about countries, including flag images and country names, ensuring a diverse and comprehensive selection of flags for players to guess.

How to Use:

  1. Guess the Flag: Examine the displayed flag image and enter the name of the corresponding country into the input field provided.
  2. Submit Your Guess: Click the "Submit" button to submit your guess and receive immediate feedback on its accuracy.
  3. Receive Feedback: If your guess is correct, you'll receive a congratulatory message in green text. If your guess is incorrect, you'll receive a helpful hint in red text, encouraging you to try again.
  4. Continue Playing: After receiving feedback, continue playing by entering your next guess. The game will automatically fetch a new random flag for each round, ensuring endless entertainment and learning opportunities.

Sample Screenshots of the Project:

Landing Page

Correct Answer

Incorrect Answer

How to Run?

  • Download the provided source code zip file.
  • Extract the downloaded zip file.
  • Open the html file and you are now ready to go!

Video Demonstration for Installation/Setup:


In conclusion, the "Guess the Flag Game" stands as a testament to the power of technology in fostering curiosity, education, and entertainment. Through its seamless integration of HTML, CSS, and JavaScript, the game offers a dynamic and engaging platform for players to explore the rich diversity of world flags. As players navigate through rounds of guessing and discovery, they not only test their knowledge but also deepen their appreciation for the cultural heritage and symbolism embodied in each flag. With its intuitive design and real-time feedback, the game transcends geographical boundaries, inviting players from every corner of the globe to embark on a shared journey of exploration and learning. As we bid farewell to this immersive experience, we carry with us a newfound appreciation for the colorful tapestry of flags that unite and inspire us all.

That's it! I hope this "Guess the Flag Game Using HTML, CSS and JavaScript" will assist you on your programming journey, providing value to your current and upcoming projects.

For additional tutorials and free source codes, explore our website.

Enjoy Coding :>>

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment