
You did everything right. You kept your income moderate, sold some appreciated stock, and assumed most of your gains would land in the 0% capital gains bracket. Then you filed, and your capital gains tax was an unpleasant surprise. Capital gains and qualified dividends can quietly bump you into a higher capital gains bracket because they layer on top of taxable income in your return.

