The United States is the 4th-largest country in the world, covering 3.5 million square miles.

However, over 80% of the population lives in metropolitan statistical areas (MSAs) that account for only 26% of the country’s land; and as more people move to MSAs, cities become more dense and expand outwards to account for growth. As a result, getting to and from work can be a nightmare and the costs of commuting rise.

This raises an interesting question: Which cities are the best (and worst) for commuters in terms of the overall opportunity costs?

We set out to answer this question by examining commuting trends and costs across the 50 most-populated metros, cites most likely to experience more traffic and longer commutes. We used data from the Census' American Community Survey, Bureau of Labor Statistics, U.S. Department of Transportation, County Health Rankings and Roadmaps, and Gas Buddy to explore regional and metro-level trends.

We were particularly interested in the personal costs related to the time and distance people commute, so we focused on the 80% of people who drive alone to work to best estimate the cost of commuting. We calculated the cost of commuting as the sum of the costs associated with fuel, vehicle maintenance, and time (i.e. opportunity cost).

Here’s how we defined each metric:

Fuel: We estimated the cost of fuel by calculating the amount of gas used to commute to work (in gallons) by dividing the average distance to work by the average miles per gallon across vehicles (21.1333 MPG), then multiplied that by the average gas price per gallon.

Maintenance: The cost of maintenance was calculated as the average cost of maintenance per mile (8.94 cents) multiplied by the average number of miles to work.

Time: We estimated the opportunity cost of a person’s time as the amount of money they could have earned had they been working instead of commuting by multiplying the average hourly wages by the number of hours spent commuting to work.

By adding these metrics together, we were able to rank the best and worst cities for commuters based on the average opportunity costs. Our full methodology and the formulas used can be found at the end of this study.

This analysis also uncovered regional trends, such as where commuters pay the most for gas, as well as where commuters spend the largest portion of their income on commuting.