Calculadora de Custo Médio
- Created by
- Renato Passos, Eng. de Software
- Reviewed by
- Renato Passos, Eng. de Software
Last updated: Apr 18, 2026
Formula
PM = total_gasto / total_cotas
About this calculator
The Average Cost Calculator is a practical tool for investors who need to calculate the average acquisition price of an asset after multiple purchases at different times and values. It is especially useful for those investing in stocks, real estate funds, ETFs, or cryptocurrencies, where the purchase price varies over time.
It works simply: you enter the total amount spent on all purchases (including fees, if desired) and the total number of shares or units acquired. The formula used is AC = total_spent / total_shares, where AC is the average cost. For example, if you spent R$ 1,000 to buy 10 shares of a fund and then another R$ 500 to buy 5 more shares, the average cost would be (1000+500) / (10+5) = R$ 100 per share.
When to use? Whenever you make periodic purchases of the same asset, such as in monthly contribution strategies or dollar-cost averaging. The average cost is essential for calculating profit or loss on sale, as the Brazilian IRS uses this value to determine capital gains. It is also useful to compare your average cost with the current market price and decide whether to buy more or sell.
Important precautions: Remember to include all brokerage fees, exchange fees, and taxes in the purchases, as they increase the total cost. Additionally, the average cost is only valid for the same asset (same ticker or code). If there are stock splits or reverse splits, the number of shares changes, requiring an adjustment in the calculation. Finally, the average cost does not consider dividends or interest received, which are taxed separately.
Frequently asked questions
How do I include brokerage fees in the calculation?
Add the fee amount to the total spent on each purchase before entering it into the calculator. For example, if you bought R$ 500 in stocks and paid R$ 10 in brokerage, the total spent is R$ 510.
Does the average cost change if I sell part of the asset?
Yes, when selling, the average cost of the remaining shares stays the same, but the profit or loss is calculated based on the average cost of the sold shares. The calculator only handles purchases, not sales.
Can I use it for cryptocurrencies like Bitcoin?
Yes, as long as you enter the total amount spent in reais (or another currency) and the total amount of cryptocurrency acquired. The average cost calculation is the same.
What if there was a stock split?
Adjust the number of shares: multiply the original quantity by the split factor. For example, if you had 10 shares and a 2:1 split, you now have 20 shares. The total cost remains the same, so the new average cost is half of the previous one. Enter the adjusted values into the calculator.
Do I need to include dividends in the average cost calculation?
No. Dividends and interest on equity are taxed separately and do not change the acquisition cost of the asset. The average cost considers only the amount paid at purchase.