Tax revenge is sweet. And it can be profitable, as well.

Let me explain.

I’ve been writing (and writing and writing) for the past 15 months about how some of us who live in high-cost, high-tax blue states can get a measure of tax revenge for the damage that Donald Trump and his Republican accomplices inflicted on us in the 2017 tax bill by limiting federal deductions for state and local taxes to $10,000 a year.

Now, I’ve gotten my revenge, as reflected in my wife’s and my 2018 federal tax return.

Even though we took the standard deduction for possibly the first time in our 49-year marriage, we still managed to get a tax break on our charitable contributions instead of itemizing them.

Actually, as I’ll show you in a bit, we got two tax breaks.

What’s more, our accountant got us an even better deal than the loophole the Trumpublicans inserted into the 2017 tax bill (which no one should call “tax reform”) to let some people exclude 20 percent of their income from federal tax.

Let me take you through this by parsing the federal tax return drawn up for my wife and me by our accountant, Carl Schwartz of Rosenberg Rich Baker Berman & Co. of Maplewood, N.J.

The charitable-contribution tax break came from using a loophole that allows people like me — who are older than 70½ and are taking “required minimum distributions” from retirement accounts — to divert some retirement income to charities.

These “qualified charitable distributions” — which we’ll call QCDs from now on — consist of checks made out to charities rather than to the people taking retirement account distributions.

QCDs reduce your federally taxable income. So using QCDs rather than writing personal checks to charities reduced my wife’s and my federally taxable income while allowing us to also take the standard deduction.

What’s more, there was a bonus. Using QCDs reduced the amount of investment income on which we had to pay the 3.8 percent Medicare surcharge.

Then there’s the tax break that Schwartz, who has put up with my irreverent (some would say stupid) questions for more than 20 years, got me on my earnings from The Post and ProPublica. I’m a contractor, not an employee, at both places.

I asked Schwartz about the provision put into the 2017 tax law to allow partners in law firms and investment firms and such to exclude 20 percent of their income from taxation to give them a break similar to the break that corporations got from having their federal tax rate lowered to 21 percent from 35 percent.

But Schwartz did something better. He told me I could get a 100 percent reduction by contributing an amount equal to my after-expenses contractor income to an individual 401(k) plan.

Even I could see that paying tax on zero percent of my after-expenses contractor income is better than paying tax on 80 percent of it.

I’d love to tell you whether the 2017 tax law raised my 2018 taxes or lowered them. Alas, I can’t figure that out because my return is full of schedules and calculations (such as a credit from Form 8801) that I can’t begin to understand.

Maybe the Trumpublican tax legislation simplified filing for some people. But not for my wife and me. At 29 pages of federal tax forms, our 2018 return was 3 pages longer than our 2017 return. Such is life.

Trump addendum: I’d love to see Trump’s personal tax returns even though, as I wrote two years ago after consulting various tax experts, there’s probably no way they’d show anything like “income from Russian oligarchs.”

My (nonpartisan) goal is to find out how much tax our leader is paying, if any. I also want to see how much benefit (if any) he got from special provisions stuck into the 2017 tax bill.

Finally, I’d like to know how much Social Security retirement income Trump is drawing so we can see if he’s benefiting from a special provision that pays a bonus benefit to Social Security retirement-income beneficiaries who have children under 18. Trump’s son, Barron, is 13.

Gene Steuerle of the Tax Policy Center and I estimated last year that this “Late-in-Life-Baby Bonus” adds about $15,000 a year to Trump’s Social Security benefit. (The White House, as you’d expect, declined to comment.)

Will Republicans try to limit that bonus in any way when they start pitching what I’m sure they’ll call Social Security “reforms” to reduce future benefits? Somehow, I doubt it.