No one wants to overpay for a plane ticket, and sometimes that means you have to plan ahead.

Depending on where you're traveling, planning last minute may not cost you. But for some cities the penalty for planning a trip in the last week can be painful.

You'll want to plan ahead for these cities
According to a recent study put out by Expedia (NASDAQ:EXPE) called Preparing for Takeoff: Air Travel Trends 2015, the three cities for which you'll want to plan ahead before your travels are Atlanta, New York, and San Francisco. When traveling to Atlanta, planning ahead three weeks instead of just one week will save you 73% on average. New York and San Francisco will save you 65% and 52% respectively.

Source: Expedia's Preparing for Takeoff: Air Travel Trends 2015.

What these cities have in common is that they're business hubs where last minute travelers are willing to pay a premium to fly on a moment's notice. That willingness to pay up for last minute flights means it pays for you to book ahead of time.

Optimally, buying tickets 50-100 days ahead of time for domestic flights can save you nearly $100 from the average flight's cost, and the savings can be hundreds of dollars over buying a ticket last minute.

Source: Expedia's Preparing for Takeoff: Air Travel Trends 2015.

Another tip for early planners
If you're able to plan your trip ahead of time, another way to save money is to buy your ticket on the right day of the week. According to Expedia's analysis, Tuesday is the best day to buy a plane ticket and consumers will really want to avoid buying on the weekend if they're planning in advance.

Late planners can wait for their lowest prices on Sunday, but if you're looking for the perfect time to plan your trip, buy tickets on a Tuesday 50-100 days in advance. Odds are that will get you the best price.

Planning early pays
Buying plane tickets ahead of time will normally save you money over buying them last minute, but that's especially true when traveling to Atlanta, New York, and San Francisco. So give yourself at least three weeks to plan or be prepared to pay a premium.