The formula
Net = (sale − purchase) − fees − tax on the gain
Where it comes from
Order matters. First the difference between what you sell for and what you paid; then both fees come off, because both are costs of the trade; and only on what is left does the tax apply, and only if there is a gain at all. A loss is not taxed, and in many countries it can be offset against other gains in the same tax year.
How to work it out by hand
- Multiply the quantity by the buying price: that is what you invested
- Do the same with the selling price
- Subtract both the buying and selling fees from the difference
- Apply the tax only if the result is positive
What is worth knowing
The break-even price shown is the most useful part: it is the price you have to sell at to come out level once the fees are paid, and it always sits above the buying price. With high fees the gap is not small. On tax: the rate depends on the country and the band, which is why it is a field; many places also require FIFO accounting when you have bought at several prices, and then the relevant purchase price is not the last one.