It is calculated by comparing market price of the security to the original purchase price. Gains or losses only become realized when the security is sold.
Investors commonly justify bad investing decisions because of paper gains or losses.
Although you officially recognize a transaction when you sell a security, many investors believe they haven't lost any money in an sinking investment because they haven't yet sold it. This is incorrect thinking as the market price is the best way to value your portfolio. The problem was, rules in option contracts made it impossible to sell their stock and realize their wealth. As a result, after the dotcom market crashed many paper millionaires went broke. Here if you would like to submit one.