Paying taxes on gains from long-term investments can be a major hurdle for investors. Yet the tax laws actually give heirs a huge tax break -- the ability to reset your cost basis -- when they inherit shares of stock or other investments that have gone up in value. This tax law let you wipe out potential capital gains tax liability entirely, which can cut thousands of dollars off your tax bill. Below we'll go through how to figure out what your cost basis is on inherited stock.

Hands of a person crunching numbers with a laptop and spiral notebook.

Image source: Getty Images.

The basis step-up

Capital gains taxes are calculated based on the profits after the return of capital (ROC). This means that investors will have a tax liability when they sell a stock for an amount greater than the ROC basis -- or the cost at which the equity was acquired.

The rules behind inherited stock and cost basis are simple. You calculate the cost basis for inherited stock by determining the value of the stock on the date that the person in question died, unless the person's estate chose what's known as the alternate valuation date, which is six months after the date of death. In many cases, that can be much different from the deceased person's cost basis before death.

If a person purchased Walmart stock at the beginning of 1980, when it was trading at a split-adjusted price of roughly $0.08 per share, and then sold the holding shortly before death 40 years later, a substantial tax would be due because of gains the stock had made through the decades. However, if that stock had been bequeathed to an heir, the cost basis would be reset to the company's share price on the day of the deceased's passing or at the alternative valuation date -- depending on what was stipulated by the estate.

The perk here is that decades of stock growth would then not be subject to taxation, and the heir would pay a much smaller tax bill on any shares sold at a profit. On the other hand, securities sold or gifted before the owner's death are subject to taxes based on the original cost basis. Inherited stocks will often be subject to lower taxes because the cost-basis step-up reduces the amount of capital gains. 

Lawmakers created the cost basis step-up rules for a couple of reasons. As anyone who has invested for a long time can attest, keeping track of the cost basis for your stocks can be an ongoing nightmare. Keeping records of every purchase and reinvestment over time is a monumental task. When you have to rely on someone else's records dating back to before you even took ownership of the inherited stock, that task can become nearly impossible. In addition, because assets in a person's estate are potentially subject to estate taxes, the basis step-up eliminates the possibility of double taxation.

Figuring out the basis

If substantial time has passed since you inherited the stock, you'll need to find prices for the shares at the date of death. Fortunately, those prices are readily available from financial news sources and from company investor relations departments.

In addition, if you enrolled in an automatic dividend reinvestment plan (available via most major brokerages) that resulted in your purchasing additional shares after you inherited them, it's important to understand that the cost basis of the inherited shares is separate from the cost basis of the newer shares. If you fail to account properly for both sets of shares, you can end up paying more in capital gains taxes than you should.

The cost-basis calculation should be the same whether a person inherits stock through a revocable trust or a will. The same holds true for stocks inherited through a brokerage. 

Finally, keep in mind that the step-up rules apply only to property that was legally included in the deceased person's estate at death. Gifts of stock that someone gave you while they were still living don't get a step-up, and trusts on your behalf that became irrevocable prior to the death of whoever created the trust often won't get favorable treatment, either.

Nevertheless, for most situations involving inherited stock, the basis step-up rules make things a lot simpler and less costly for heirs. Just knowing the rule and using it correctly can save you thousands in unnecessary taxes.

Determining valuation basis for estate taxes

If the value of an estate is large enough to qualify for federal estate taxes, then the included stocks will be taxed as part of the overall value of the estate. The federal estate tax threshold was raised to $11.58 million per individual and $23.16 million per married couple in 2020, and stocks won't be taxed as part of an inheritance provided the overall value of the estate is below those levels.

The vast majority of estates are valued at levels that do not trigger federal estate taxes, but a valuation basis for included stocks must be used to determine if estates exceed the threshold. Just as with inheriting stocks, the valuation basis of stocks and other equities in the estate is set by their market value on the day of the deceased's passing or the alternate valuation date. Some states also have their own estate and inheritance taxes, but the standards for determining cost basis are the same.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at knowledgecenter@fool.com. Thanks -- and Fool on!