The holiday season is still a couple of months away, but according to a new analysis out today, you've only got about three weeks before airfares start going up.

An analysis of last year's fares by comparison travel website Kayak found that average prices for domestic travel for Thanksgiving jumped 17% above the lowest average fares after mid-October.

For Christmas and New Year's Eve, average fares increased up to 51% and 25%, respectively, after mid-October.

Kayak spokeswoman Jessica Casano-Antonellis recommends that travelers book domestic flights for the Monday or Tuesday before Thanksgiving, when prices are lower.

As for return flights, she says the weekend after Thanksgiving has some of the highest fares. Instead, travelers should consider returning on Thanksgiving Day, when fares dropped 36% below the mean last year. Flying back Friday or the following Tuesday would also be less expensive.

International fares are generally going to be higher the closer you get to the holidays, she says.

"Last year international airfares for Thanksgiving and December holidays all steadily increased until the day of departure, so we recommend booking as soon as possible," she says.

Airlines have generally been cutting back on the number of flights they make available as they try to increase profits.

"Airlines recognize that demand is very high. … They can charge high prices, and people have to pay for it," says Bijan Vasigh, professor of economics and finance at Embry-Riddle Aeronautical University. "Airlines are able to increase their prices by 30%, 40%, 50%, sometimes double the price in order to compensate for the periods when [demand] is not that strong."

Those who traveled the weekend before Christmas paid some of the highest fares last year, so Casano-Antonellis says travelers should fly out as close to Dec. 25 as possible. The Saturday before and the Saturday after Christmas had some of the most expensive fares.

International travelers saved money when they departed between Dec. 23 and 26 and returned between Dec. 28 and Dec. 31.

If you want to travel domestically for New Year's Eve, your best bet is to depart between Dec. 29 and Jan. 1 and return between Dec. 31 and Jan. 3.

The worst time to fly internationally was New Year's Day, when prices spiked 33%.