These are the US cities with the best — and worst — traffic

Justin Sullivan | Getty Images

Some cities are notorious for endless traffic — but which are the worst and which are the best? 

Personal finance website WalletHub recently released a study determining the best and worst cities to drive in, taking into consideration a multitude of factors, ranging from car theft rates to average gas prices to parking rates and more.

One of the metrics considered was the annual hours spent in congestion per auto commuter, or how long the average driver in a city sits in traffic. WalletHub determined this metric by looking at data from INTRIX, a car services and transportation analytics company.

The data reveals that Greensboro, North Carolina is the most traffic-free metro area with commuters spending only four hours annually in congestion. Meanwhile, big cities with clogged streets ranked at the bottom, with commuters in Atlanta, Georgia, spending 102 hours annually stuck in traffic.

The best cities for traffic, based on annual hours spent in congestion per commuter in 2017, are:

1. Greensboro, North Carolina: four hours

2. Wichita, Kansas and Corpus Christi, Texas (tie): six hours

3. Lincoln, Nebraska: seven hours

4. Fresno, California; Fort Wayne, Indiana; Madison, Wisconsin; Winston-Salem, North Carolina (tie): nine hours

5. Tucson, Arizona; Tulsa, Oklahoma; Toledo, Ohio; Durham, North Carolina; Lubbock, Texas (tie): 10 hours

The worst cities for traffic, based on annual hours spent in congestion per commuter in 2017, are:

1. Atlanta, Georgia: 102 hours

2. San Francisco, California: 91 hours

3. Los Angeles, California: 79 hours

4. New York, New York: 70 hours

5. Miami, Florida: 64 hours

But driving is about more than traffic. So for its full study on the best and worst cities to drive in, WalletHub looked at 29 relevant indicators across four key dimensions in a sample of 100 of the most populated U.S. cities. It considered factors including average gas prices, auto-repair shops per capita, as well as traffic metrics (any city with more than 70 annual hours in traffic automatically scored zero points) and more.

When taking into consideration the other key metrics, WalletHub determined the five best cities to drive in are: Raleigh, North Carolina; Corpus Christi, Texas; Orlando, Florida; Greensboro, North Carolina and Plano, Texas.

On the flip side, with all factors considered, WalletHub found the worst cities to drive in are Detroit, Michigan; San Francisco, California; Oakland, California; Philadelphia, Pennsylvania and Seattle, Washington.

Don't miss: These are the 10 best states for summer road trips

Like this story? Subscribe to CNBC Make It on YouTube!

Jay Leno takes a ride in one-of-a-kind cars on an all new Jay Leno's Garage