The calculation for a capital gain or loss is straightforward: it starts with the selling price of your capital asset minus its cost basis (what you originally paid for it).
If the number is positive (in other words, you made money on the sale) that's your capital gain.
On the other hand, if the number is negative (you lost money) you have a capital loss unless the item is personal-use property, which can never be deducted as a capital loss.
Your net capital gain/loss is calculated by subtracting your capital losses from your capital gains (Schedule D). If you have a net capital loss, you're allowed to deduct up to $3,000 ($1,500 if married filing separately) per year as a capital loss. If your net capital loss is more than the yearly limit, you can carry the loss to next year's return as a capital loss carryover.
Janice purchased 100 shares of stock for $3,000 and later sold it for $5,000. She has a $2,000 capital gain.
Terrence lost $2,400 when he sold his coin collection. He has a capital loss and can deduct $2,400 of the loss on this year's taxes.
Richard sold shares of stock in 5 different companies, and the result was a net capital loss of $5,400. He can deduct $3,000 of the loss on this year's taxes and has a $2,400 capital loss carryover for next year.