Want to beat July 4th traffic? Leave before 6 a.m.

Traffic on this year's July 4th holiday is expected to the worst in a decade, but you may be able to beat it with your smartphone.

The team behind turn-by-turn navigation app Waze poured through its users' crowd-sourced data and concluded that before 6 a.m. is the best time to skip town. With AAA predicting that 35.5 million cars will be on the road during the holiday -- a 4% increase over last year -- road speeds are otherwise going to be at a crawl.

On average, speeds are about 10 miles per hour slower during Independence Day travel than on typical days, Waze said.

It doesn't help that people travel the roads both for vacation and to see fireworks. If you're driving just for the pyrotechnics, there's a small window of opportunity when the roads may not be completely terrible.

For shows that start at 9 p.m., traveling between 7 p.m. and 8 p.m. is your best bet, Waze says. Traffic gets significantly worse after 8, peaking right before the show at 9.

Plan on sticking around for a while after the show. Traffic probably won't return to normal until around 11 p.m.

Waze is a free app for Android and the iPhone. When a user activates the app, the software begins sending information about traffic flows back to the company's servers. The data is then relayed to users by recommending the fastest routes.

The company's technology powers Apple's new turn-by-turn navigation feature in its soon-to-be released iOS 6 for the iPhone.

AAA predicted that the roads will be particularly awful this year thanks to falling gas prices -- they're down 44 cents on average from their April peak.

The fact that Independence Day falls on a Wednesday also means that many people will take longer vacations, spanning two weekends and clogging up roads for longer stretches. Air travel is likewise expected to rise.

In all, AAA expects 42.3 million Americans to travel 50 miles or more from home during the holiday, a 5% increase over last year.  That would tie July 4, 2007 -- the last Independence Day before the Great Recession -- for the biggest travel day of the past decade.