Blog
How to Calculate Capital Gains on an Investment Sale (Short-Term vs Long-Term)
The same $5,000 profit can be taxed completely differently depending on one detail most investors don't track closely enough: exactly how long the asset was held.
Selling an investment for more than you paid creates a capital gain, and the arithmetic for the gain itself is simple. What determines how much of that gain you actually keep is a second calculation many people skip: how long you held the asset, which in many tax systems decides which tax rate applies.
The basic gain or loss formula
Capital Gain or Loss = Sale Price − Cost Basis (Cost basis = original purchase price plus any fees or commissions paid to acquire it)
Why the holding period matters
In systems that distinguish between short-term and long-term gains — such as the U.S. federal tax code — assets held for one year or less before selling are typically taxed as short-term gains, at the same rates as ordinary income. Assets held for more than one year often qualify for long-term capital gains rates, which are frequently lower than ordinary income tax rates. Other countries use different holding-period rules or flat rates entirely, so confirm the specific rule in your jurisdiction before relying on this distinction.
A worked example
You bought an investment for $4,000 (including fees) and sold it for $6,200.
Capital Gain = $6,200 − $4,000 = $2,200
How the tax owed can differ by holding period
| Scenario | Holding period | Illustrative tax rate | Illustrative tax owed |
|---|---|---|---|
| Sold after 8 months | Short-term | 24% (ordinary income bracket) | $528 |
| Sold after 14 months | Long-term | 15% (long-term capital gains bracket) | $330 |
Why this matters as a decision, not just a tax filing detail
In the example above, waiting a few extra months to cross the one-year threshold reduces the tax owed on the exact same $2,200 gain by roughly $198 — without the investment needing to move at all. This is why many investors deliberately track purchase dates and consider the holding period before selling a position that's close to the one-year mark, especially for a large gain where the rate difference matters most.
Calculating a capital loss
The same formula applies when the sale price is lower than the cost basis, producing a capital loss. In many tax systems, realized capital losses can offset realized capital gains in the same year, and sometimes a limited amount of ordinary income, with unused losses carried forward to future years — rules that vary significantly by country and are worth confirming with a tax professional or official guidance.
What this simplified calculation leaves out
- Transaction fees on both the purchase and the sale should be included in the calculation — fees on the purchase increase cost basis, and fees on the sale reduce net proceeds.
- Multiple purchases of the same asset at different prices require an average or specific-lot cost basis calculation before this formula can be applied accurately.
- State, provincial or local taxes may apply in addition to national capital gains tax and are not included in the illustrative rates above.
- Tax rates, brackets and holding-period rules change over time and by jurisdiction — verify current rates with an official source or tax professional before filing.
Tax-loss harvesting: using losses on purpose
Some investors deliberately sell a losing position before year-end specifically to realize a capital loss that offsets gains elsewhere, a strategy known as tax-loss harvesting. The calculation is the same subtraction as any other capital loss, but the decision to trigger it is deliberate rather than incidental — and many jurisdictions have a 'wash sale' rule restricting an immediate repurchase of a substantially identical asset, which is worth checking before using this strategy.
Why record-keeping matters as much as the formula
The capital gains formula itself is simple subtraction, but it's only as accurate as the cost basis and sale proceeds fed into it. Keeping records of every purchase price, sale price, associated fee and reinvested dividend (which can adjust cost basis in some account types) prevents a rushed, inaccurate estimate at tax time when the actual records are hardest to reconstruct.
Separate the arithmetic from the tax rules
The gain calculation is mechanical: proceeds minus adjusted cost basis gives a gain or loss before tax. The tax calculation is a separate step that depends on the applicable jurisdiction, holding period, rates, exemptions and loss rules. Keeping those two steps separate makes the article's arithmetic easier to verify and reduces the risk of treating an illustrative tax rate as a universal rule.
Frequently asked questions
Is cryptocurrency taxed the same way as stocks for capital gains?
In many jurisdictions, yes — cryptocurrency is treated as property subject to capital gains rules similar to stocks — but treatment varies by country, so confirm the specific rules that apply to you.
Does reinvesting the proceeds avoid capital gains tax?
Generally no, in most standard investment accounts — the gain is typically realized and taxable at the time of sale regardless of what you do with the proceeds, though certain tax-advantaged accounts or specific rollover rules can differ.
How do I calculate capital gains if I bought the same asset at different times?
You'll need to determine which "lot" was sold using a method such as FIFO, specific identification, or average cost, depending on what your tax jurisdiction allows or requires.
Is capital gain the same as the tax I owe?
No. Capital gain is the calculated increase in value. Tax owed depends on the applicable tax rules, rates, basis adjustments and other circumstances.
Why does holding period matter?
Some tax systems apply different treatment to gains depending on how long an asset was held. The exact thresholds and rates depend on the jurisdiction and tax year.
Conclusion
A capital gain is a straightforward subtraction, but the tax owed on it depends heavily on the holding period and the tax rules in your jurisdiction. Track your purchase dates and cost basis carefully, calculate both the short-term and long-term tax scenario before selling a position near the one-year mark, and confirm current rates with an official source before filing.
Figures in this article are illustrative. Results depend on your own rates, fees, taxes and circumstances, and are for educational and planning purposes rather than financial advice.