Tax agency ABCD3 example
- Input
- média 8.25, vende 400 @ 10.75
- Expected output
- 1000.00
400 remain at R$ 8.25.
average cost after selling some shares
Add a Sell row after your purchases and read its result right below. Later rows start from the reduced position, with the same average cost.
400 remain at R$ 8.25.
50 × 8 − 50 × 10; 50 remain at R$ 10.
40 × 12 − 40 × 10; 60 remain at R$ 10.
(600 + 540) ÷ 120.
59,982 − 50,015.
27,500 − 9 − 25,007.50.
Add up what you paid in each purchase (quantity × price + fees) and divide by the total quantity. With 100 shares at 15 and 300 at 20, the cost is 1,500 + 6,000 = 7,500 for 400 shares, so the average is 18.75.
The position resets to zero and the average disappears. The next purchase starts a new average, inheriting nothing from the previous cost.
Not in this tool. A sale larger than the position is flagged as an error and ignored, because short selling has its own rules that sit outside the calculation.
No. It is the gain before any tax, the starting point for the calculation. Exemptions, rates and loss offsets depend on current law and are not part of this tool.
After 4 trades
Position 100 · average cost R$10.00
Position 300 · average cost R$9.50
Position 800 · average cost R$8.25
Position 400 · average cost R$8.25 · result +R$1,000.00
Buy 100 at R$7.00 each
Amount invested in the order, fee included: R$700.00
You would hold 500 at an average cost of R$8.00
Brokerage and exchange fees are added to the buy cost and deducted from the sale value, as in the Brazilian tax agency example. Enter the total order fee as an amount of money.
This is not investment advice or an income tax calculation. Your data stays in your browser.