Commuting can be a pain, particularly in Trumbull, according to a report by a financial website.

A study conducted by NerdWallet — a consumer financial site — finds that Trumbull residents have one of the worst commutes in Connecticut, topped only by residents of Ridgefield and Westport.

The rating is based on car insurance premiums, gas price, one-way commute time, percentage of workers traveling by car and percentage of commuters using public transportation.

NerdWallet found that the average Connecticut driver pays over $800 more on car insurance than the average American. The website examined 50 locations in Connecticut and found that Ridgefield, Westport and Trumbull have the costliest commutes — in terms of time and money — in the state.

Trumbull’s rating is based on the following: The average car insurance premium in Trumbull is $2,394, average gas price is $3.77, average one-way commute time for Trumbull residents is 28.9 minutes, percentage of local workers traveling by car is 89.9% and percentage of commuters using public transportation: 3.2%.

The towns in the top ten for worst commute are: Ridgefield, Westport, Trumbull, Colchester, Bethel, New Milford, Stratford, Naugatuck, Winsted and Terryville.

Those in Newington, West Hartford, Wethersfield and Hartford pay the most for car insurance at an average rate of $2,483 each year, over twice the national average of $1,100. On the other hand, Groton residents enjoy the cheapest average price in Connecticut, at $1,537, or $946 cheaper than the highest rates in the state.

Where you fill up your tank can also have a big impact on your pocketbook. Greenwich drivers pay Connecticut’s highest gas prices at $4.02 a gallon. Those in Bristol enjoy the state’s cheapest prices for gas at $3.57 a gallon, 45 cents less than in Greenwich.

The car you drive will also have a big impact on your yearly rate, according to NerdWallet. Premiums for the most popular car models can range in price by a few hundred dollars. Overall, having a small SUV or minivan is the cheapest way to go. Driving a sports car may make your commute more enjoyable, but it will pump up your insurance bill, NerdWallet says.

Locations with higher population density and more traffic congestion often have higher premiums.

The costs of driving can be painful. On average, Connecticut residents pay $1,902 for car insurance, over $800 more than the rest of the nation, and $3.71 per gallon for gas, or 29 cents more than the national average.

Fairfield County workers have the worst commutes. Four of Connecticut’s top five worst commutes are in Fairfield County. Residents spend the longest time getting to work — nearly half an hour on average.

Not all Connecticut commutes are headaches. Groton commuters enjoy the second-shortest commute time in the state — 19.2 minutes — and cheapest average annual premium for Connecticut at $1,537.

Residents of Hartford and New Haven, Connecticut’s second- and third-largest cities, also benefit from a better commuting environment. Residents can escape expensive insurance premiums by taking advantage of public transit. Both areas have a high percentage of people who commute via public transportation and lower-than-average commute times for the state.