Disclosure: PortfolioPilot is a technology product of Global Predictions Inc, a Registered Investment Advisor. You must subscribe to receive personalized investment advice.
Taxes

How to calculate your capital gains tax

By
Alexander Harmsen
Alexander Harmsen is the Co-founder and CEO of PortfolioPilot. With a track record of building AI-driven products that have scaled globally, he brings deep expertise in finance, technology, and strategy to create content that is both data-driven and actionable.
Reviewed by
PortfolioPilot Compliance Team
The PortfolioPilot Compliance Team reviews all content for factual accuracy and adherence to SEC marketing rules, ensuring every piece meets the highest standards of transparency and compliance.
How to calculate your capital gains tax

Understanding and calculating capital gains tax is a crucial skill for any investor. This comprehensive guide provides step-by-step instructions, hypothetical scenarios, and uses general asset classes to help you navigate through what might otherwise be a complex process.

Introduction to Capital Gains Tax

Capital gains tax is incurred when you sell an asset that has increased in value. It is important to note that the tax is only applied to the profit—the difference between the selling price and the original purchase price (or “cost basis”)—and not on the overall sale amount.

The types of assets that may be subject to capital gains tax can include:

Tax rates on capital gains depend on the duration the asset was held and can vary based on your overall income and tax filing status.

Steps to Calculate Capital Gains Tax

Step 1: Classify the Asset

Assets are primarily classified into two categories based on the holding period:

  • Short-term: These are assets held for less than a year and are taxed as ordinary income.
  • Long-term: Assets held for more than a year may qualify for lower tax rates, usually maxing out at 20% (determined based on income levels).

Step 2: Determine the Cost Basis

The cost basis includes the purchase price along with related expenses needed to acquire the asset such as:

  • Purchase price
  • Brokerage fees
  • Installation or setup fees

Hypothetical Scenario: Imagine you acquired 150 shares at $10 each, incurring $50 in brokerage fees, which means your cost basis would be: Cost Basis Calculator : 150 x $10 + $50 = $1,150 

Step 3: Adjust the Cost Basis

The cost basis can be adjusted based on certain events affecting the asset’s value:

  • Reinvested dividends
  • Improvements made (relevant for real estate)
  • Returns of capital

Step 4: Calculate the Selling Price

The selling price is the total amount received from selling the asset. It is important to account for all forms of compensation received.

Step 5: Calculate Gain or Loss

The capital gain or loss is determined by subtracting the adjusted basis from the selling price:

Capital Gain/Loss = Selling Price - Adjusted Basis

Continued Example: If you sold all 150 shares at $20 per share: Selling Price = 150 x $20 = $3,000

Capital Gain/Loss: $3,000 − $1,550 = $1,450

Step 6: Apply the Tax Rate

Find the appropriate tax rate based on whether the asset is classified as short-term or long-term. Multiply the total capital gain / loss with the tax rate and the result will be your capital gains tax (or credit).

Utilizing Financial Tools

To assist in the calculation process of capital gains taxes, tools like PortfolioPilot are available, which help automate some calculations for users' convenience. It's important to note, however, that while these tools are designed to aid in financial management, the ultimate responsibility for tax calculation accuracy lies with the individual, and results can vary based on specific financial situations.

Wrapping Up

While following these steps can help you understand and potentially manage your capital gains tax obligations more effectively, it’s crucial to maintain records and stay informed about tax regulations that apply to your transactions. Keep in mind that tax laws are complex and subject to change, and personal situations differ. Therefore, these guidelines should be considered as a starting point and not tax advice.

Capital Gains Tax & Cost Basis – FAQs

What types of assets are typically subject to capital gains tax?
Assets like stocks, bonds, ETFs, mutual funds, real estate, precious metals, cryptocurrencies, and collectibles may incur capital gains tax when sold for a profit.
How does the IRS classify short-term versus long-term capital gains?
Assets held less than one year are taxed as short-term gains at ordinary income rates. Assets held longer than a year may qualify for long-term rates, which historically cap at 20% depending on income.
What costs can be included in the original cost basis of an investment?
Cost basis typically includes the purchase price plus related expenses, such as brokerage fees, installation costs for real estate, or setup fees for certain assets.
How do reinvested dividends affect the cost basis of stocks or funds?
Reinvested dividends increase the adjusted basis of the asset. This higher basis can reduce the taxable capital gain when the asset is eventually sold.
In the example of 150 shares bought at $10 each with a $50 fee, what is the cost basis?
The cost basis totals $1,550, calculated as 150 shares × $10 ($1,500) plus $50 in brokerage fees.
If those 150 shares later sold at $20 each, what is the taxable gain?
Selling at $20 per share yields $3,000. Subtracting the $1,550 adjusted basis results in a $1,450 capital gain.
Why is the sale price not the only figure taxed in capital gains?
Tax is only applied to profit—the difference between selling price and adjusted basis—not the gross sale amount, ensuring investors aren’t taxed on their original principal.
How can improvements affect the basis of a real estate asset?
Capital improvements, such as renovations, increase the adjusted basis of the property, which reduces potential taxable gain when the property is sold.
What is the maximum long-term capital gains tax rate mentioned in the guide?
Long-term capital gains rates vary by income but typically max out at 20% under current IRS rules.
How do capital losses interact with capital gains in tax calculations?
Losses from selling assets below their adjusted basis can offset gains, reducing taxable income. This applies within the annual IRS guidelines for capital loss treatment.

How optimized is your portfolio?

PortfolioPilot is used by over 30,000 individuals in the US & Canada to analyze their portfolios of over $30 billion1. Discover your portfolio score now:

Sign up for free
1: As of February 20, 2025