Nobody likes paying taxes on investments. But some lucky taxpayers are able to get a 0% rate on some of their investment income.

In the following video, Dan Caplinger, The Motley Fool's director of investment planning, runs through the rules for the 0% rate, explaining how it can apply to both long-term capital gains and qualified dividend income. Dan notes that on the dividend side, the rate only applies for ordinary stocks, with certain pass-through entities like real-estate investment trusts Annaly Capital (NLY 0.62%) and Chimera Investment (CIM -0.78%) paying out dividends that get taxed at ordinary income tax rates. Similarly, business development companies Prospect Capital (PSEC -0.64%), Ares Capital (ARCC -0.41%), and Main Street Capital (MAIN -0.44%) have traditionally paid out a combination of qualified and non-qualified dividend income, making their distributions only partially eligible for the 0% rate. Dan concludes that if you have room in those lower two brackets, selling stocks at a gain can be a smart move to make the most of your tax-free opportunity.