How to Calculate Capital Gains Tax
Turning a profit on investments such as stocks, property, or collectibles—all considered capital assets—is certainly exciting, but the celebration can cease quickly if you’re unprepared for related tax implications. Thankfully, learning how to calculate capital gains tax can help you plan more effectively, minimize surprises, and make smarter financial decisions in the process.
What is a capital gain?
A capital gain—the profit realized when you sell an asset—is calculated as follows: Sale Price – Adjusted Cost Basis = Capital Gain (or Loss).
The sale price is what you received when you sold the asset, while the cost basis is what you originally paid plus certain allowable adjustments. The difference between the two is the gain (or loss if it’s negative) and the amount you’ll have to pay capital gains tax on. If you bought shares of stock for $2,000 and later sold them for $3,500, for example, your gain would be $1,500: profit taxed by the IRS.
Realized vs. unrealized gains
Capital gains tax only applies to realized gains. An unrealized gain, on the other hand, occurs when the value of your investment increases but you haven’t sold it yet. If you bought stock for $20 and it’s trading at $35 today, for example, you technically have a $15 per-share gain—but only on paper. You don’t owe any taxes until you sell the stock and lock in (or “realize”) the profit.
While the concept may seem simple, the rules determining how much you owe can get complicated: with holding periods, adjusted cost basis, exemptions, and special rates all coming into play, meaning the final number can look dramatically different depending on various circumstances. Understanding how capital gains tax works, likewise, isn’t just an exercise in tax literacy but can indeed help you make better decisions about when to sell investments, how long to hold them, and how to structure your financial strategy to keep more money in your pocket.
Understanding cost basis
Determining cost basis can be simple in some cases but tricky in others. If you bought 100 shares of stock at $20 per share, your cost basis is $2,000. If you’ve reinvested dividends, bought shares at different times and prices, or paid brokerage fees, however, your cost basis must be adjusted accordingly.
Calculating your cost basis
The calculation is often even more complex in real estate. Suppose you bought a house for $200,000. If you spend $50,000 on a major renovation further down the road—something beyond routine maintenance (e.g., upgrading your kitchen or replacing the roof)—your cost basis increases to $250,000. If and when you eventually sell the home, such improvements reduce your taxable gain.
Special rules are also sometimes in play depending on how you acquired the asset. If you inherited property, for example, the IRS allows a “step-up in basis” (meaning the cost basis is reset to market value on the date of inheritance with the potential to dramatically reduce future tax liability if you sell shortly afterward). If the asset was received as a gift, however, you typically assume the donor’s original basis—possibly resulting in a higher taxable gain if the asset has appreciated over time.
Short-term vs. long-term capital gains
If you sell an investment within one year or less, any profit is considered a short-term capital gain. These are taxed as ordinary income and thus subject to the same rates paid on wages or business income, anywhere from 10% to 37% depending on your tax bracket.
If you hold the investment for more than one year, on the other hand, the profit is considered a long-term capital gain and taxed at preferential rates of 0%, 15%, or 20% (depending on your income level). For many taxpayers, the long-term rate is substantially lower than their ordinary income rate—precisely why financial advisors often encourage investors to hold investments for at least a year if possible.
As an example, suppose you’re in the 32% income tax bracket and you sell a stock after holding it for just 10 months. Realizing a $10,000 profit, you’ll pay $3,200 in federal taxes on that gain. If you instead hold the stock for 13 months and then sell with a long-term capital gains rate of 15%, your tax bill would drop to $1,500: saving you a hefty $1,700 simply for waiting.
How capital gains tax rates are determined
The rate you’ll pay on capital gains depends on both the type of gain (short-term or long-term) and your taxable income. For long-term gains in 2026, the rates are at 0%, 15%, and 20%. Most middle-income investors fall into the 15% category, while lower-income taxpayers may qualify for 0%.
High-income earners not only pay 20% on long-term gains but are sometimes also subject to a 3.8% Net Investment Income Tax (NIIT)—an additional surtax that applies to individuals with a modified adjusted gross income above $200,000 ($250,000 for married couples)—meaning effective long-term capital gains tax can reach 23.8% at the federal level for these individuals. Some states also impose their own capital gains taxes ranging from modest to substantial, depending on where you live.
Offsetting capital gains with losses
One valuable tax code feature is the ability to offset capital gains with capital losses. This strategy (i.e., tax-loss harvesting) allows you to reduce your taxable income if some of your investments don’t perform well, with losses first applied against gains of the same type; short-term losses reduce short-term gains, and long-term losses reduce long-term gains.
If losses exceed your gains, you can apply up to $3,000 of the excess against ordinary income annually—with any remaining losses carried forward to future years. If you lost $5,000 in one year and had no gains, for example, you could apply $3,000 against your regular income and then carry the remaining $2,000 forward to the next year.
This system ultimately provides some consolation for investors who experience losses while likewise encouraging strategic planning when it comes to selling underperforming assets.
Special considerations
While the basic rules apply to most investments, some notable exceptions and special provisions are worth knowing.
Selling a primary residence
Selling a primary residence can significantly benefit homeowners, for example, as individuals can exclude up to $250,000 of capital gains from taxation ($500,000 for married couples filing jointly) provided they’ve lived in the home for at least two of the last five years. This exclusion, in turn, can mean selling a home without owing any capital gains tax at all—even if it’s appreciated significantly.
Collectibles
Collectibles such as artwork, antiques, or rare coins are treated differently, with gains on these assets taxed at a higher maximum rate of 28% regardless of income level. Some small business stock, similarly, may qualify for special exclusions under Section 1202 of the tax code: allowing some investors to avoid paying taxes on part of the gain if they meet specific requirements.
Retirement accounts
Retirement account (e.g., 401(k) and IRA) investments also follow different rules as they’re tax-advantaged. In this case, you won’t pay capital gains tax on sales within the account, and taxes are deferred until you withdraw the money (for traditional accounts) or avoided altogether if you use a Roth IRA and meet distribution requirements.
Capital gains tax management strategies
Although taxes are unavoidable, strategies do exist to minimize their impact. One of the most effective? Simply holding investments longer than a year to take advantage of lower long-term rates. Another method is to use tax-advantaged accounts (e.g., 401(k)s, traditional IRAs, or Roth IRAs) to defer or eliminate taxes entirely.
Investors can also plan sale timing to stay within a lower tax bracket. If you anticipate a lower income year (perhaps due to retirement or a career change), for example, you’ll likely want to sell appreciated investments at that time when your taxable income is lower. Donating appreciated assets to charity is another option, steering clear of capital gains tax while simultaneously receiving a charitable deduction.
Finally, strategic tax-loss harvesting can help reduce your overall tax liability. In selling losing investments to offset gains, you must plan for this carefully to avoid wash-sale rules that prevent you from claiming a loss if you repurchase a “substantially identical” security within 30 days.
The takeaway
Whether you’re selling stocks, unloading a rental property, or cashing in on collectibles, learning how capital gains tax is calculated can help give you an edge—with the system rewarding patience and long-term investing and offering tools such as loss offsets and exemptions to help soften the blow.
Have a more complicated scenario on your hands such as selling inherited property, navigating the sale of a business, or managing multiple asset classes? In this case, you should still learn the basics to help maximize after-tax returns and keep your financial goals on track while also consulting a tax professional for personalized advice. We’d love to hear from you, or anyone else with questions, at 201-488-2828 or support@kaleedscpa.com.