When an investment you purchase increases in value, you have an unrealized gain until you decide to sell it, at which point you have a realized gain. Conversely, if an investment you own declines in value, you have an unrealized loss until you sell, or until the value of the investment increases. Here's how to calculate your unrealized gains and losses, and why it may be important.

How to calculate
Simply put, an unrealized gain or loss is the difference between an investment's value now, and its value at a certain point in the past. The calculation can be done for any time period, such as the unrealized gain over the past month, but the most useful unrealized gain/loss is calculated from the time at which the investment was originally made. And, the calculation is rather simple.

First, figure out the investment's current market value. For example, if you own 100 shares of a certain stock, and its current value is \$70 per share; your investment is worth \$7,000.

Next, calculate how much you originally paid. If you paid \$65 per share for those 100 shares, your original investment was \$6,500. If you want to be thorough, you can include trading commissions in your original cost, since they are part of your cost basis for tax purposes.So, if your brokerage charges a \$9.99 commission, this amount can be added to your original cost if you want a precise unrealized gain/loss calculation to estimate taxes. Also, some brokerages can help provide that info for you. To check out what brokerages may offer, visit our broker center.

Finally, subtract the original amount you paid from the current value. So, in our example, the unrealized gain would be \$500.

Why is it important?
Unrealized gains and losses can be useful to know because they let you know how your portfolio is performing. They are also known as "paper" gains and losses because they only exist on paper -- the money isn't yours until you sell.

Unrealized gains and losses can be important for tax-planning purposes. You only have to pay capital gains taxes on realized gains, so by calculating your unrealized gains, it can give you an idea of how much you could have to pay in taxes should you choose to sell. Similarly, many people use losses on investments to offset capital gains or other taxable income through a strategy known as tax-loss harvesting. Calculating your unrealized losses can let you know if you could potentially use your losing investments for a tax break.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at knowledgecenter@fool.com. Thanks -- and Fool on!

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.