A passport is like a magic carpet. With one, flying to foreign lands is simply a matter of wishing it (and paying for it). Without one, you're earthbound. But as powerful as a passport is, some are more powerful than others.

For the lucky citizens of certain countries, a passport is all it takes to gain access to most nations on the planet. For others, the document is practically useless without a pre-approved visa fastened to one of its pages.

People who can enter a country without such a visa are sometimes said to be traveling "visa-free." Technically, this is not true. When the unsmiling immigration officer gives you a stare and then slams a stamp onto one of your passport's pages, you're getting a "visa on arrival." But it beats the often lengthy and complicated process of applying for a visa at a country's consular office or embassy.

You're probably wondering where your passport ranks. The U.K.-based citizenship and immigration firm Henley & Partners addresses that question with its 2017 Visa Restrictions Index, a global ranking of countries based on how many other countries their passports can access without a pre-approved visa. For the most powerful passport in the world, the total is an impressive 176.

German passport Ultraviolet light reveals a security hologram on a 2017 German passport. (Photo: John MacDougall/AFP/Getty Images)

Who issues those mighty documents? Passports from the United States, Canada, France, Sweden and Japan can get you into a lot of places, but they're all still outmatched by at least one country. The fortunate few are citizens of Germany.

Many countries do fall just behind them, though. A Swedish passport can unlock 175 countries without a pre-approved visa, while Denmark, Finland, Italy, Spain and the United States are tied for third place with 174 countries. The U.K. is in fourth place with access to 173 countries, a ranking shared with Austria, France, Singapore and several other countries. Many countries' passports fall in the 170 to 150 range.

Afghanistan issues the index's weakest passport. Afghans can visit just 24 countries without first acquiring a visa. Passports from Iraq, Pakistan, Syria and Somalia rank just barely ahead.

The world's rarest passport, meanwhile, reportedly comes from the Sovereign Military Order of Malta. Only about 500 of these passports are currently in circulation around the planet, according to the Order of Malta.

Changi International Airport, Singapore Travelers enter immigration control at Changi International Airport in Singapore. (Photo: 1000 Words/Shutterstock)

If you hold a diplomatic passport, the world is your oyster. Issued to government representatives and diplomats who travel on official state business, these passports often allow holders to avoid standard immigration and customs checkpoints altogether.

Over the past decade, U.S. citizens have been required to use a passport for any travel beyond the 50 states and territories. But not everyone needs one to cross national borders. People whose home countries issue an EU-compliant ID card can skip around the European Union without one.

Some other ID cards can replace a passport. An APEC Business Travel Card grants entry to any of the 21 APEC (Asia-Pacific Economic Corporation) member states. The NEXUS card, intended for low-risk citizens who travel frequently between the United States and Canada, can scoot you across that line.

When even a strong passport can't get you into the country of your choice, getting a pre-approved visa is not always a hassle. In the United States, a good travel agent can usually take care of it.

Editor's note: This article has been updated since it was published in September 2014.