How to Calculate a Capital Gain
A capital gain equals the selling price minus the purchase price, also called the cost basis, and it is realized only once the asset is actually sold.
The Capital Gain formula
Calculator
Enter what you paid, what you sold for, how many units and the tax rate to get the gain before and after tax.
What you paid, including buying costs such as commissions.
What the asset sold for, after any selling costs come out.
How many shares or units the sale covered.
The rate that applies to you, which depends on your country and how long you held the asset.
The whole position comes to $5,000 once the sale goes through, and a negative figure there is a capital loss.
- Gain per unit
- $25
- Percent return
- 62.5%
- Tax on the gain
- $750
- Gain after tax
- $4,250
- Gain or loss
- Capital gain
Each unit sold for $25 more than it cost.
The gain is 62.5% of what you originally paid, which is the figure to compare against other investments.
At this rate the tax on the gain works out to $750.
That leaves $4,250, which is the number worth comparing with a gain taxed at a different rate.
Selling below the cost basis flips the same subtraction into a capital loss.
How to calculate Capital Gain, step by step
- 1Write down the cost basis. What you paid for the asset, including purchase costs such as commissions, since those raise the basis and shrink the taxable gain.
- 2Write down the selling price. What the asset actually sold for, after any selling costs are taken out.
- 3Subtract. Capital gain = selling price − cost basis. A negative answer is a capital loss rather than a gain.
- 4Scale it by the units sold. Multiply the per-share gain by the number of shares sold to get the total gain on the position.
- 5Take out the tax. Multiply the gain by one minus the rate that applies to you, because the rules differ by country and by how long the asset was held.
Worked example: Capital Gain
You buy 200 shares at $40 each, a cost basis of $8,000, and later sell them at $65 each for proceeds of $13,000. The gain per share = 65 − 40 = $25, so the total capital gain = 25 × 200 = $5,000. As a percent return that is (25 ÷ 40) × 100 = 62.5%. At a tax rate of 15% the tax owed = 5,000 × 0.15 = $750, leaving 5,000 − 750 = $4,250 after tax.
Capital Gain questions
What is the difference between a realized and an unrealized gain?
A gain is unrealized while you still hold the asset, so it sits on paper and moves with the price. Selling realizes it, which fixes the amount and is normally what makes it taxable.
How do you calculate a capital loss?
The same subtraction. If the selling price is below the cost basis the answer is negative, and that figure is the capital loss, which tax systems often let you set against gains elsewhere in your portfolio.
Does inflation eat into a capital gain?
Yes. Part of a nominal gain can be the price level rising rather than a rise in buying power, so deflate both the purchase and selling prices by a price index before subtracting to find the real gain.
Get AP Econ exam tips in your inbox
Occasional emails with study tips, new interactive graphs, and exam-season reminders. Free, no spam.
No spam. Unsubscribe anytime. Read our privacy policy.
Keep track of what you have studied
A free EconLearn account adds progress tracking, your quiz history, and achievements. Studying here is free either way, and there is nothing to pay for as a student.
Create a free accountAlready have one? Sign in
Last updated