Learn the stock market › Tools
Stock average cost calculator: what have you paid per share?
How to work out your average cost
Add up what you paid for the shares, fees included. Divide the total by the shares you own. An example with three trades:
- You buy 100 shares at $50 and pay a $5 fee. That costs $5,005, so the average is $50.05.
- You buy 100 more at $30, again with a $5 fee. You have now paid $8,010 for 200 shares, so the average is $40.05.
- You sell 50 shares at $60 and pay a $5 fee. You receive $2,995. The shares you sold cost 50 × $40.05 = $2,002.50, so the gain is $992.50. You have 150 shares left and the average is still $40.05.
Why does selling not change the average?
A sale removes shares and their part of the cost at the same rate. It makes no difference whether you sell at a gain or a loss. Each remaining share still carries the same average, because the sum treats all your shares of one stock as a single pool.
How do you lower your average cost?
The average falls when you buy below your current average, like the second purchase in the example. People call this averaging down. The purchase does not move the price, and the shares you already held are worth what they were worth before. What changes is that the price needs to rise less for you to break even, and that you have more money in the same company if the price keeps falling. A low average says nothing about the company, only about what you paid.
Stock splits
A split changes the number of shares but not what you paid. In a 4-for-1 split, 100 shares become 400 and the average becomes a quarter of what it was. In the calculator, enter that as a purchase of the 300 new shares at a price of 0. Reverse splits and spin-offs are not covered here.
Average cost and your tax return
The calculator uses the average for every sale, and that is the rule in Sweden. The US rule is different. The IRS lets you use an average for mutual fund shares and certain dividend reinvestment plans. For other stock, it says you use the cost of the particular shares you can identify, and otherwise the shares you bought first. So the average tells you what you paid, but the gain shown here may not be the gain on a US tax form.
Work it out
How the calculator works
- The rows count from the top down, so enter them in the order the trades happened.
- A fee is added to the cost of a purchase and taken from the proceeds of a sale.
- A row that sells more shares than you own at that point does not count.
- Tax is not worked out.
- The numbers sit in the link, so anyone who gets the link sees them. No prices are fetched.
Sources
- IRS, Publication 550, Investment Income and Expenses, for 2025 returns, read 4 November 2026.
- Skatteverket, Räkna ut ditt omkostnadsbelopp, in Swedish, read 4 November 2026.
How would a different start date have gone? Work it out in If I had invested.