I had been pondering this recently myself too. This question motivated me to do a little research. It appears that what happens is that (take a deep breath) the capital gain does push you into the next tax bracket, but the capital gain is always interpreted as the "last" income you received, so that if your non-capital-gains income is less than the threshold, it will all be taxed in the lower bracket, and only your capital gain will be taxed in the higher bracket (but it will be taxed at the capital-gains rate of that higher bracket).
In short, a capital gain can only push capital gains into higher capital-gains tax brackets; it cannot push ordinary income into higher ordinary-income tax brackets. In addition, the amount of the capital gain is taxed in a marginal fashion, such that any portion of the gain that will "fit" into a lower bracket will be taxed at a lower level, with only the topmost portion of any gain being taxed at the top rate.
This site is one claiming this:
Will capital gain or dividend income push my other income into a higher tax bracket?
No, the tax rates apply first to your “ordinary income” (income from sources other than long-term capital gains or qualifying dividends) so these items that are taxed at special rates won’t push your other income into a higher tax bracket.
If my ordinary income puts me in the 15% tax bracket, can I receive an unlimited amount of long-term capital gain at the 0% rate?
No, the 0% rate applies only to the amount of long-term capital gain and dividend income needed to “fill up” the 15% tax bracket. For example, if your ordinary income is $4,000 below the figure that would put you in the 25% bracket and you have a $10,000 long-term capital gain, you’ll pay 0% on $4,000 of your capital gain and 15% on the rest.
There are several Bogleheads forum threads (here, here, here and here) that also touch on the same issue.
The last of those links to the IRS capital gains worksheet. I traced through the logic and I believe it confirms this. Here's how it works:
- On Line 7 you effectively enter your taxable income minus your capital gains --- that is, your taxable ordinary income.
- On Line 8 you enter the threshold above which capital gain taxes apply (i.e., end of the 0% capital gains bracket).
- On Line 9 you enter the smaller of your taxable income and the cutoff.
- On Line 10 you enter the smaller of that result and your taxable ordinary income. Since your taxable ordinary income is always less than or equal to your whole taxable income, this means you enter either the lesser of your taxable ordinary income and the cutoff.
- The first of two crucial lines is Line 11, where you subtract Line 10 from Line 9, and as it says on the form "this amount is taxed at 0%". If your taxable income was over the cutoff, but your taxable ordinary income was less than the cutoff, Line 9 will be the cutoff and Line 10 will be your taxable ordinary income. Subtracting these will give you the amount of your capital gain that fits into the 0% bracket, and this amount will be taxed at 0%. The rest of the capital gains (the portion that reaches into higher brackets) will be filtered through the rest of the worksheet, which performs the same logic for the other thresholds (i.e., marginally taxing your capital gains at the various rates).
- Finally, the second crucial line is way down on Line 24, where you "figure the tax on the amount in Line 7" --- that is, you figure the tax on your taxable ordinary income using the ordinary-income brackets. This means the tax on your ordinary income, using the ordinary tax brackets, is figured wholly separately from the capital gains. Thus the capital gains income cannot change the tax bracket structure of your ordinary income.
(In conclusion, we now know Mitt Romney's secret.)