Grieving a lost spouse is hard enough, but you may feel another shock when tax time comes around.

Without planning, a surviving spouse may likely be surprised to find their taxes have risen sharply despite lower income because of an inherent “widow’s penalty” in the tax code. The penalty occurs when a surviving spouse’s tax status reverts to single from married filing jointly. Standard deductions shrink and tax brackets compress – a double-whammy for widows.

Not only could surviving spouses see higher taxes, but they could also face higher Medicare premiums and Social Security tax because both have income thresholds. More often, women suffer the penalty because women tend to live on average five years longer than men, said Katie Carlson, head of wealth strategy at Bank of America Private Bank.

“It’s a tough one,” said Katie Carlson, head of wealth strategy at Bank of America Private Bank. “There’s no way to completely avoid it.” But there are ways to mitigate it, she said.

Here’s how widows are penalized: