If you're living in San Francisco and you owe the taxman, it's going to hurt to write that check.

That's because residents in the Bay Area generally are on the hook for $7,226 on average, in addition to what was withheld during the year, according to a recent study from MagnifyMoney.

Analysts at the personal finance site studied IRS data for returns filed from 2012 to 2016 in the 100 largest metro areas in the country.

Denver came in second with residents facing an average bill of $5,607. Sacramento rounded out the top three, with an average of $4,243.

See below for where your local metro area ranks in terms of tax refunds and taxes owed.