Life is full of mundane tasks: taking out the garbage, pulling weeds, cleaning up the kitchen.

Today we'll explore the investing equivalent: calculating the adjusted cost base (ACB) of a security. It's a boring job all right, but knowing how to do it will make you a more informed investor – and save you stress at tax time.

**Why does the ACB matter?**

You need to know your ACB in order to calculate the capital gain (or loss) for tax purposes when you sell a security. The ACB only matters for non-registered investments; for registered accounts it's irrelevant because there are no capital gains taxes.

For simple buys and sells, calculating the ACB and capital gain is straightforward. For example, say you bought 100 shares of XYZ Corp. at $30 each and paid a commission of $10. Your ACB would be $3,000 (100 times $30) plus $10, or $3,010.

If you later sold all 100 XYZ shares for $40 each, with a $10 commission, your proceeds would be $4,000 (100 times $40) less $10, or $3,990. Your capital gain would be $3,990 minus $3,010, or $980. (Notice that the commission increases the ACB, but reduces the sale proceeds.)

For simplicity, I'll leave out commissions in the examples that follow, but you should include them in your own calculations.

**Tracking multiple buys**

Most investors don't acquire all of their shares in one transaction; they buy them over time and at different prices. As a result, their average cost changes.

In most cases, tracking such changes isn't a big deal. To calculate your ACB, simply add up all of the money you invested to acquire the shares. If you divide the ACB by the number of shares, you get your ACB per share.

For example, if you bought 100 shares of XYZ at $30, and later purchased another 100 shares at $35, your ACB would be $3,000 plus $3,500, or $6,500. Your ACB per share – or average cost – would be $6,500 divided by 200, or $32.50 per share.

You would use this ACB per share figure of $32.50 to calculate your capital gain, or loss, when you ultimately sell all or part of your shares.

Say you sold all 200 XYZ shares at $40 each, for example. Your capital gain would be $8,000 (200 times $40) minus $6,500 (200 times $32.50), or $1,500.

But what if you sold just 100 shares at $40 each? Your capital gain would be $4,000 (100 times $40) minus $3,250 (100 times $32.50), or $750. The idea here is that, whether you sell all or part of your shares, your capital gain is based on the average cost for each share.

**What happens to the ACB when you sell?**

Skill-testing question: In the previous example, what is the ACB per share of the 100 shares that you didn't sell? Answer: $32.50. When you sell shares, the ACB per share doesn't change, even though the number of shares you own goes down. This is a key point to remember.

To calculate the total ACB of the remaining shares, multiply the ACB per share by the number of shares you still hold.

**More complex situations**

Tracking the ACB takes a bit more work in some cases.

For example, if your shares are enrolled in a dividend reinvestment plan (DRIP), the ACB will change every time additional shares are purchased. For that reason, many DRIP investors use a spreadsheet to track their ACB. There are also online resources that can help, such as adjustedcostbase.ca.

It's also a good idea to keep transaction records provided by your broker or transfer agent. Brokers often provide a "book value" or "average cost" figure, but it never hurts to double-check these numbers against your own calculations.

Another thing to watch out for is return of capital (ROC). Some fund and REIT distributions include a portion of ROC, which is not taxable. Rather, you must subtract ROC from the ACB of the security. This gives rise to a larger capital gain, or smaller capital loss, when the security is ultimately sold. Still another complicating factor are distributions that are automatically reinvested by some ETFs. These distributions increase the ACB.

Calculating your ACB may not be exciting, but it's one of those jobs investors have to do. Might as well do it right.