Computing Crypto Capital Gains in Brazil with Average Cost
Reference pages define the terms. This one walks the calculation, because the gap between knowing what average cost means and being able to produce a defensible number for a month of trading is where most people get stuck.
The quantity you are computing
You dispose of crypto when you sell it for reais, exchange it for another token, or use it to pay for goods or services. The taxable amount is broadly the difference between what you receive on the disposal and your cost, meaning what you paid to acquire the asset including associated costs.
Everything below is about the second term, because the first is usually observable and the second has to be constructed.
Building the average cost
Average cost answers a question that arises the moment you buy the same asset twice: which units did you sell? Rather than picking, you hold one blended cost per unit and recompute it as you acquire.
The method in three rules:
- On a purchase, add the amount paid, including associated costs, to your total cost, and add the units to your total quantity. The new average is total cost divided by total quantity.
- On a disposal, the cost of what you disposed of is units disposed multiplied by the current average. The gain is what you received less that amount.
- After a disposal, reduce total quantity by the units sold and reduce total cost by the same units multiplied by the average. The average itself does not change.
That third rule is the one people implement wrongly. A disposal removes units at the average; it does not move the average. Only acquisitions move it.
Worked shape
Buy 1 unit at a price, then buy 1 more at a different price: your average is the midpoint of the two, and your total cost is the sum. Sell 0.5 units: the cost of that half is 0.5 multiplied by the average, your gain is proceeds less that figure, and your remaining 1.5 units still carry the same average. Buy again at a third price and the average moves for the first time since the sale.
Follow those steps in order and the arithmetic is unambiguous. The difficulty is never the formula; it is having every acquisition in the right order.
Crypto to crypto is where it gets interesting
Brazil treats crypto to crypto exchanges as taxable events rather than tax free swaps, so a single trade touches both sides of your records at once:
- It is a disposal of the token you gave up, at its value in reais at that moment, producing a gain against that token's average cost.
- It is an acquisition of the token you received, at that same value in reais, which enters the receiving token's average cost.
Recording only one side is the most common error in Brazilian crypto records, and it corrupts everything after it: the disposed token's quantity never reduces, and the received token acquires a zero cost that turns its eventual sale entirely into gain.
The conversion problem
Your computation is in reais, but a great deal of crypto trading is priced in dollars or in a stablecoin. Every leg denominated in something other than reais needs conversion, at the moment of the transaction rather than at month end.
The trap is subtle: converting the gain at one rate is not the same as converting each leg at its own rate. The acquisition happened on one day and the disposal on another, and both the crypto price and the currency rate moved in between. Convert each leg, then compute the gain in reais.
Fix one rate source and one convention, document it, and use it everywhere. An inconsistent convention produces a number you cannot reproduce next year.
What to keep
- Every acquisition in chronological order, with associated costs included.
- Every disposal, including both sides of every crypto to crypto trade.
- The running average cost and running quantity per asset, so any month can be recomputed.
- Transfers between your own wallets identified as transfers, since they are not disposals and must not touch the average.
- Your currency conversion source and convention.
Consult the verified summary table on our Brazil guide for the limits, frequencies and deadlines that apply to you, and confirm current rules with the Receita Federal or a qualified Brazilian accountant.
Our capital gains reference defines the concepts, and Brazilian crypto tax covers the reporting obligations that sit alongside them.
General information, not tax advice. Rules change and depend on your circumstances. Confirm the current position with the relevant tax authority or a qualified tax professional.
FAQ
No. A disposal removes units at the current average and reduces both total quantity and total cost proportionally, leaving the average itself unchanged. Only acquisitions move the average. Implementing this wrongly is the most common arithmetic error in the method.
As both sides at once. It is a disposal of the token you gave up, at its value in reais at that moment, and an acquisition of the token you received at that same value, entering the receiving token's average cost. Recording only one side leaves the disposed quantity unreduced and gives the received token a zero cost.
Convert each leg at the moment of its own transaction, then compute the gain in reais. Converting the gain at a single rate is not equivalent, because the acquisition and the disposal happened on different days and both the crypto price and the currency rate moved in between.
No. They are not disposals and must not touch the average cost or the quantity. Records that treat a self transfer as a sale invent a gain that does not exist and corrupt the average from that point forward.
