Figuring out the right or wrong time to book a flight can be maddening.

The savings window is constantly moving, and one rarely has the luxury of booking whenever he or she pleases.

Fortunately for air travelers, has reviewed more than 350 million airfares between the U.S. and 3,000-plus markets to pinpoint the best time to book flights.

Overall, the ideal window ranges between two and four months out.

Travelers eyeing flights between the U.S. and Canada, Mexico or Central America can expect to find the best deals two months prior to their travel dates. Flights between the U.S. and the Caribbean and South America should be booked slightly further out, at 76 days and 81 days, respectively.

Three months is the best time to book a flight between the U.S. and Asia, according to CheapAir’s research. Interestingly, that prime time booking period was as far out as seven to nine months just a year ago.

“There is an excess capacity on trans-Pacific flights (especially China),” CEO Jeff Klee told CNBC. “If there are more seats available at the lower price point at dates closer to travel, the over-supply might explain this phenomenon, at least in part.”

Airfares for flights between the U.S. and Europe are likely to be at their best 99 days in advance of travel dates while travelers planning a trip to Africa or the Middle East will want to book roughly four months (119 days) ahead of their departure. notes that the summer season means higher demand in places like Europe. That said, travelers are encouraged to book further in advance this time of year.

For domestic flights within the continental U.S.,’s 2017 Annual Airfare Study found 54 days in advance to be the best time to book on average.

The challenge for air travelers is having the ability to book a flight in the ideal window.

Some events may require passengers to secure their ticket well in advance while others may force them to lock in a seat at the last-minute. Nonetheless, given how prices can fluctuate, Airline Weekly’s managing partner Seth Kaplan says travelers shouldn’t pass up a deal regardless of the timing.

“These are averages, not hard-and-fast rules,” he told CNBC. “If you see what looks like a too-good-to-be-true cheap fare many months before you plan to travel, grab it — that particular fare won’t necessarily drop further.”

Last month, a FareCompare analysis revealed that prices for summer airfare will begin climbing later this month as the pre-summer and peak seasons begin in the U.S., Europe and Asia.