Traveling this summer? Don't book too early

Getty Images. The combination of a strong economy and near-record consumer confidence is convincing many Americans this is the time to get away.

Everyone knows that planning a last-minute vacation is expensive. But booking flights and hotels too far ahead of time can also cost you.

The average hotel stay actually becomes cheaper as the day approaches. Even airfare, which jumps substantially in the two weeks before a flight, tends to be more expensive if purchased too many months in advance, according to new data from Adobe Digital Index.

"The early bird doesn't necessarily get the worm in travel," said Tamara Gaffney, principle research analyst for Adobe Digital Index. "That's counter-intuitive in both hotels and flights."

The study, which is based on over 15 billion visits to major U.S. travel and hotel sites between 2013 and 2015, points to the cheapest times to buy for the upcoming summer holidays. It's too late for Memorial Day, but some of the best Fourth of July buying is this weekend.



Hotel prices are up 5 percent overall for the first four months of 2014, but savvy consumers can still find deals by buying in the right window. For both the average domestic and average international hotel, the best time to buy is about a month out, according to Adobe's data.

Hotels know that if a customer is booking very early, they're interested in a particular location and don't need to be lured through the door with discounts. As it gets closer to the day of the booking, full hotels drop out of the market and other hotels will lower prices to fill vacancies.

Read More Loews: Hotels poised for good summer, but face dollar headwinds

"Hotels try to capitalize on the supply and demand curve," said Gaffney. "It's way more pronounced when you look at major holidays, because those are the times they figure they're going to get full occupancy anyways, so they wait longer to push the prices down."

The data indicate that when more bookings happen early, there is less price volatility. That may be why Memorial Day bookings, which tend to be more last-minute and opportunistic than other holidays, fluctuate more in price than other summer holidays, said Gaffney.

For economy hotels ($120 or less per night), the biggest average discounts show up 40 days out. For more expensive hotels, you can get a slightly below-average rate 30 days out. The window can also shift for certain cities: For Las Vegas, Seattle or Boston, the best time to book is over 100 days out, but for New York and Honolulu the best time is around 30 days before the trip.

The curve is less dramatic for flights. For domestic flights, the best time is 90 days before the trip, when travelers can save an average of 15 percent. Prices are higher if tickets are bought more than 150 days before a flight.

Read More The travel trade: 4 vacation stocks to buy

Once again, it's way too late for Memorial Day-the best time to buy was January 30. But an average discount of 10 percent is still available this weekend for the Fourth of July, and July 21 is the best time to buy for a 17 percent discount on Labor Day tickets.

As any last-minute traveler knows, prices for plane tickets shoot up in the 20 days before the flight. According to the Adobe data, prices increase 3 percent every day during that period, with the latest buyers paying 60 percent more than average. Still, one in three travelers wait to book until those last 20 days.

"That's a lot of sub-optimal buying," said Gaffney. "Maybe they can't help it, but every single day costs you."



More From CNBC