If you want to calculate how much you've gained or lost on an investment, you'll need to know your cost basis. It's important for your tax records, too.

Let's run through a very simple example. Imagine that you buy 100 shares of **Meteorite Insurance** (ticker: HEDSUP) for $50 each, spending $5,000. That's your cost basis. If, a few years later, you sell those 100 shares for $75 each, collecting $7,500, you will realize a gain of $25 per share, or $2,500. You need to know your cost basis to figure out what your profit is on an investment. This is true for all kinds of assets, even houses. If you bought your home for $200,000 and sold it for $250,000, your cost basis (sometimes referred to as a tax basis) is $200,000, and your basic gain $50,000.

If you buy shares of the same stock at different times, you'll want to keep track of your cost basis for each transaction. If you sell some of the shares at some point, you'll be able to specify which shares you sold, thus controlling your reportable gain.

Cost bases can get a little trickier, though, so read on.

**Splits**What happens to your cost basis if your stock splits? Well, it splits, too. As an example, imagine that your cost basis for your 100 shares of

**Home Surgery Kits**(ticker: OUCHH) is $40 per share, or $4,000. If it splits 2-for-1, so that you now have 200 shares, your cost basis will split in the other direction, becoming $20.

Pre-split, you had 100 shares, with a basis of $40 per share, for a total initial investment of $4,000. Post-split, you have 200 shares with a basis of $20 per share, for a total initial investment of ... $4,000. See? When it comes to the value of your overall holding, nothing has really changed.

If you sell the 200 shares for $15 per share, you'll collect $3,000. Subtract your cost basis of $4,000 from that, and you're looking at a loss of $1,000.

**Dividends**Dividends can make cost bases trickier – when they're reinvested in additional shares. If you reinvest your dividends in a security, that will increase your cost basis and thereby reduce any eventual gain. For example, if you buy 100 shares of stock in

**Scruffy's Chicken Shack**(ticker: BUKBUK) for $20 each (total: $2,000) and you receive and reinvest $200 of dividends, here's how the cost basis works: It's originally $20 per share, or $2,000. Once the dividends have bought you more shares, though, your basis rises to $22 per share, or $2,200.

As you might recall, dividends get whacked with their own tax, so if you don't account for them in your cost basis, you're setting yourself up to be taxed on them one more time.

**Commissions**Be sure to factor commissions into your cost bases, as that can save you a little money come tax time, especially if you trade frequently. Here's how to include them. Imagine that you bought 100 shares of

**Sisyphus Transport Co.**(ticker: UPDWN) for $50 each, or $5,000 total, and sold the shares later for $60 each, or $6,000, paying your brokerage a $10 commission for each trade.

It might look like your taxable gain is $1,000, the result of subtracting your cost basis from your proceeds. But the IRS lets you factor in the cost of the commission. Thus, your purchase price or cost basis is really $5,010, or $50.10 per share. And your proceeds are really $5,990, or $59.90 per share. Subtract $5,010 from $5,990, and you'll get a gain of $980 -- reflecting the two commission charges.

That might seem trivial, but if you have 40 $10 commission charges in the gains or losses that you report in a given tax year, that comes to a total of $400. If you're paying a tax rate of 15% on your long-term gains, you'll avoid paying $60 in taxes on those commissions. If your gains were short-term, taxed at your ordinary income tax rate of, say, 25%, then you'll save $100.

**Special situations**What if you inherit stock (or some other asset) from someone? Well, then special rules kick in, with your basis usually being the value of the stock on the date that the bequeather died. Thus, if Uncle Fred leaves you shares of

**Carrier Pigeon Communications**(ticker: SQUAWK) that he bought at $40 per share and they were at $100 on the day that he died, you get a "stepped up" basis of $100. So if you sell the shares for $120 each, your gain (excluding commissions in this example) will be $20 per share, not $80. A good deal, eh?

Different rules apply if you receive an asset such as stock as a gift. First off, make sure you ask for and get the gift-giver's cost basis in the stock, as that will probably be your basis when you sell the shares at some point. If you sell and realize a gain, your cost basis is that of the giver's. If you sell and realize a loss, the basis is either the giver's basis or the value of the stock at the time of the gift, whichever is lower.

If you own stock jointly with a spouse who dies, leaving you the shares, you may be able to "step up" the cost basis of half of the shares to the price at the time of death.

Other rules apply to cost bases in different situations, but the rules I've laid out here will apply to most people most of the time.

Don't ignore your cost bases for your investments, as you will most likely need to know them at some point.