If you want to make the most of your Social Security benefits, you'll need to make some important moves in your investment portfolio. Proper planning can help you keep most or all of your Social Security benefits instead of paying back a good chunk in taxes, and it will help maximize the returns on the rest of your retirement portfolio.

Here are three steps you should take before you claim Social Security in order to make the most of it.

A couple sitting on the couch talking, while looking at a laptop computer.

Image source: Getty Images.

A quick primer on Social Security taxation

In order to reduce taxes paid on Social Security, it helps to understand how the tax is calculated. The IRS uses a metric called "combined income" to determine what portion of your benefits, if any, are taxable. Combined income is equal to your adjusted gross income plus half your Social Security income, plus any nontaxable interest.

Below are the thresholds showing how much of your Social Security benefits are considered taxable at various combined income levels.

Taxable Amount Single Married
0% Below $25,000 Below $32,000
Up to 50% $25,000 to $34,000 $32,000 to $44,000
Up to 85% Over $34,000  Over $44,000

Table by author. Data source: Social Security Administration.

The reason it's "up to 50%" or "up to 85%" in the table above is that there's also a limit on taxation based on how much your income exceeds the threshold amounts. For example, if you're single with a combined income of $30,000 and Social Security benefits of $10,000, you'd end up paying tax not on half the $10,000 in benefits, but rather on half the $30,000 amount your combined income exceeds the $25,000 threshold. Half of $5,000 works out to $2,500. Similarly, if you're filing a joint return with a combined income of $40,000 and benefits of $15,000, you'd pay tax on $4,000 -- half the $8,000 amount by which the combined income exceeds the $32,000 threshold.

To minimize the taxes when you start receiving Social Security, here are three things to consider in the years leading up to retirement before you claim your benefits.

1. Roth conversions

The more money you can get into a Roth IRA before you claim Social Security benefits, the better a position you'll be in to avoid taxes. That's because withdrawals from a Roth IRA don't count toward your adjusted gross income since you already paid taxes on those funds in the year you contributed or converted to the Roth IRA.

Converting funds from a traditional IRA or 401(k) to a Roth account requires you to pay income taxes on the amount converted. That's on top of any other income. So it's best to perform a Roth conversion in a year when the rest of your income is extremely low. That might be during a gap in your working career or early on in retirement before claiming Social Security.

Ideally, you'll be able to keep your tax bill extremely low on these Roth conversions. Paying a little bit of tax now can save you a lot in taxes later on in retirement when your pre-tax retirement accounts start making you take required minimum distributions and you're also taking income from Social Security.

2. Tax-gain harvesting

Another step to take in years where your income is low is called tax-gain harvesting. This is a process whereby you purposefully book a gain on an investment to pay taxes on the capital gains. The trick is that you can pay 0% in taxes if you keep your taxable income below a certain threshold. In 2022, that threshold is $41,675 for individuals and $83,350 for those filing jointly.

You can keep those funds invested, too. In fact, unlike with tax-loss harvesting, you can buy back your shares immediately without worrying.

The aim with tax-gain harvesting early in retirement or during years of low income is to set yourself up to pay less in capital gains later on when you actually need the money for living expenses. That way, when you sell to raise cash, you won't add as much to your combined income. And if you have some investments that go down in the intervening years, you may be able to take a loss and offset gains or income elsewhere to keep taxes low.

3. Adjust your asset allocation

While you're performing the above steps, it may be an opportunity to adjust your asset allocation in order to maximize your retirement portfolio. Instead of thinking of your Social Security benefits as something outside of your investments and savings, you should consider them to be more like a fixed-income retirement asset.

Every year you delay taking Social Security retirement benefits from 62 to 70, their value increases. If you wait longer to claim Social Security, it can cover more of your fixed income needs when you do start getting benefits. Therefore, it makes sense to try to account for the value of Social Security in your portfolio relative to your other assets and ensure your asset allocation is in line with your overall plan and risk profile.

Specifically, as you wait to claim, it might make sense to have a higher percentage of your retirement investment portfolio in stocks than if you claimed earlier. Doing so can help you maximize your portfolio returns over the long run -- and also potentially avoid taxes on income from bonds and other fixed-income investments.

To be sure, you should rebalance your portfolio throughout retirement to maintain a proper asset allocation. But if you're delaying Social Security, you ought to account for its increasing value in your portfolio when deciding how to rebalance.

A few maneuvers in your retirement portfolio can make a world of difference in how much you end up having available to spend when you need the money. Take these steps early in retirement, and you'll be able to enjoy a lower tax bill and a bigger portfolio later.