A capital gain is defined as the gain or loss from the sale or exchange of a capital asset. Capital assets include things such as stocks, bonds, real estate, collectibles, to name a few. Capital assets do not include inventory items (items held for sale in the ordinary course of business).
A long term capital gain is what most people think of when they think of a capital gain. In order to qualify as a long term capital gain, the asset must be held for at least one year.
The gain is the excess of the amount realized on such sale over the cost basis of the asset. If the basis exceeds the proceeds, you (obviously) have a loss.
Don't forget that the gain is reduced by costs of making the sale. This effectively is done by adding these costs to the basis of the asset. The basis of the asset is generally what you paid for it, increased by improvements or other costs. If you sell a stock at a brokerage house (not sure how else you would) the amount reported as the sale factors the brokerage commission and the net amount is the reported amount. Same for the purchase. For that reason we don't like it when the broker tells us that the taxpayer bought a stock at $22.50. What about that commission?