The state and local tax burden for Californians runs middle-of-the-pack nationally, according to a WalletHub analysis that measured the tax collector’s take against comparative income levels.

The financial information site’s data crunchers studied spending on state and local sales, excise, property and income taxes and compared that cash flow to different income brackets. When I filled my trusty spreadsheet with their results, I found California had the combined No. 23 lowest tax burden among the 50 states.

“It’s important to note that our analysis does not focus on tax rates but rather on the share of a person’s income that he or she contributes toward various tax obligations,” WalletHub wrote. “For instance, tax rates may be lower in one state, but because of a comparatively higher cost of living, the actual tax burden may be higher for that state’s residents.”

In my composite rankings — averaging scores for low, middle and high incomes — Alaskans overall spent the lowest share of their income on state and local taxes followed by Delaware and Nevada. Illinois was at the bottom of this grading, followed by New York and Hawaii.

How did California get middling grades on taxes — a topic of which many observers seem to say the state is failing? When WalletHub divided tax payments to California paychecks, the state looks better than expected.

Take the tax burden for low-income taxpayers, as calculated by WalletHub. California got a No. 22 ranking as these households send 9.65 percent of income to in-state taxes, a shade under the median burden of 9.75 percent among the 50 states.

The best state for lower-paid Americans was Delaware, where the tax burden ran 5.24 percent of income. Alaska was No. 2 at 5.87 percent, then Montana at 6.77 percent. Worst? The state of Washington at 14.59 percent, then Illinois at 13.18 percent and Hawaii at 12.94 percent.

Yes, California isn’t kind to those who do best: High-income Californians pay 9.13 percent of income to taxes — only 17 states get more from their wealthiest citizens. Median was 8.25 percent.

Alaska was best for the rich, too: 3.01 percent of income went to in-state taxes. No. 2 was Nevada at 4.31 percent, then Wyoming at 5.03 percent. Worst? New York at 12.48 percent, Connecticut at 11.13 percent, and Illinois at 11.01 percent.

In between, WalletHub found California was roughly average for the middle class with a No. 22 ranking at 9.22 percent of income going to taxes vs. a 50-state median of 9.47 percent. Tops were Alaska at 4.35 percent, Delaware at 5.74 percent and Montana at 6.53 percent. Worst? New York at 12.7 percent, Illinois at 11.71 percent and Hawaii at 11.59 percent.

If you believe that taxes should be progressive — that is, the wealthy pay more — this math suggests that scenario is a rarity.

My spreadsheet tells me just 12 states place a higher burden on its highest-income taxpayers vs. the lowest-income residents. Delaware was “fairest” with its highest earners paying a 31 percent larger share of income for taxes vs. its lowest-paid citizens. No. 2 was Vermont at 21 percent, then Maine at 17 percent.

Note that for all the talk about California soaking the rich, WalletHub figures show the state’s tax burden was slightly regressive. The state’s lower-paid folks spent 5 percent more of their income on taxes than the best paid, a result that was 15th “fairest” nationally.

Most regressive was Nevada, where top income’s share for taxes was 50 percent less than the lower rungs on the income ladder. Next was Washington at 49.8 percent, then Alaska at 48.7 percent.

While we’re on politically touchy topics, my trusty spreadsheet looked at how WalletHub results added up along the great national political divide — red states, those that helped elect President Donald Trump, vs. blue states, ones that voted differently in 2016.

Tax burdens, by WalletHub math, showed blue states — many with a tax-the-rich mentality — fared better for low-income taxpayers — averaging a No. 24 ranking vs. 27th for red states.

But those red states — known to favor “trickle down” low taxation of the rich — scored better for the more fortunate. Trump-leaning states averaged a No. 25 ranking for middle-income tax burdens vs. 27th for blue states. The red-state gap was even wider for high-income tax burdens: An average 21st ranking vs. 32nd in blue states.