The stock market had yet another record-breaking year in 2020. While that means many portfolios likely ended up in the black, it could also mean substantial tax bills for investors who sold stocks last year — especially those that were not tucked inside an individual retirement account, a 401(k) or some other tax-advantaged retirement account.

Investors who sold individual-company stocks while the market was up could be liable for capital gains taxes.

After dropping nearly 20% in March as the pandemic first gripped the U.S., the stock market indexes made a powerful comeback.

Someone who bought Tesla stock in March at its lowest price of $71 and then sold those shares in December at its highest price of $718 would have a capital gain of $647 per share.

Generally, any profit that an investor makes on the sale of stock is taxable at either 0%, 15% or 20%, depending on that person's taxable income and filing status if the shares were owned for more than a year. Stocks held for less than a year are taxed at the shareholder's ordinary income tax rate.

Also, any dividends received from stocks are usually taxable.

Most single people fall into the 15% capital gains rate, which applies to incomes that fall between $40,001 and $441,000. Married couples who earn between $80,001 and $496,600 have a capital-gains tax rate of 15%.

"We had clients who sold investments in 2020 in anticipation of a possible bump in taxes on capital gains in 2021," said Alex Kindler, a partner at H2R CPA in Green Tree, Pa.

Those concerns were caused by the upcoming change in presidential administrations, Kindler said.

Many people don't pay attention to capital-gains taxes because their investments are in retirement funds. If shares are held inside of a traditional or Roth IRA or a 401(k), the taxes on stock dividends and capital gains are deferred.

As long as the money is held inside one of those investment vehicles and remains in the account, the account owner pays no taxes on the investment growth, interest, dividends or investment gains.

But for nonretirement investment, tax issues can complicate things. Selling shares can be a tough decision, especially when the stock is hot and the stock owner doesn't have a financial need.

"If you feel you have experienced all the gain that you can and the stock is vulnerable because it's run its full price course, then you take the gain — and pay the taxes," said Robert Fragasso, a financial planner in Pittsburgh.