Q: I sold a stock at a profit of about $2,000. How much capital gains tax can I expect to pay?

Capital gains tax depends on two things: your income and how long you held the investment.

First, determine whether we're talking about a long-term or short-term gain. The IRS defines a long-term capital gain as a profit you made on an investment held for more than a year. So, if you owned the stock for at least a year and a day, it's a long-term capital gain and is taxed at lower rates than short-term gains.

If the gain was short-term, figuring the tax is easy. The profit will simply be taxed at your ordinary income tax rate. For example, if you're in the 25% tax bracket, that's what you'll pay.

Long-term capital gains are not taxed for people in the two lowest brackets (10% and 15%), but are taxed at a 15% rate for those in the middle four brackets, and a 20% rate for taxpayers in the highest (39.6%) tax bracket.

In addition to these rates, taxpayers with modified adjusted gross income above $200,000 (singles) or $250,000 (married filing jointly) will pay an additional 3.8% tax on their net investment income, which was created as part of the Affordable Care Act.

For example, let's say that you held the investment in question for more than a year, and that you're in the 28% tax bracket. Your long-term capital gains tax rate would be 15%, and when applied to your $2,000 profit, this translates to a capital gains tax of $300.

Offer from The Motley Fool: The 10 best stocks to buy now
Motley Fool co-founders Tom and David Gardner have spent more than a decade beating the market. In fact, the newsletter they run, Motley Fool Stock Advisor, has tripled the S&P 500!*

Tom and David just revealed their ten top stock picks for investors to buy right now.

Click here to get access to the full list!

*Stock Advisor returns as of 3/24/2017.