<prompt> Human: Im considering going back to grad school to get a PhD after working for a number of years. Id like to take advantage of this period, since I will most likely have 20-30k in taxable income. According to Wikipedia, this would put me in the 0 qualified dividend and 0 long-term cap gain rate cohort.However, I was wondering if the cap gains are recorded for each year and aggregated. Or is it like the entirety of the gains is summed, and taxed at the rate according to your income level in the year the gain is realized?I feel like it wouldnt make much sense if I worked for 20 years accruing stock, stopped working, then sold it all for 0 cap gain. So Im sure Im missing something here -- some guidance would be appreciated.Also if anyone else has recommended strategies to optimize opportunities while in grad school Id appreciate it. The most obvious one for me is to hang on to my low 4 rate student loans and stay invested, since that the interest will be tax deductible while in grad school. I could also contribute to Roth accounts from taxable accounts while in school, because my tax rate will be so low.Any other ideas would be greatly appreciated!Edit: Doing a bit more reading on it, and wondering if this is a valid strategy -- suppose I had 20k in income as a stipend. The upper cap the 0 LTCG bracket is around 36.9k, which would leave me with a buffer zone of 16.9k in cap gains I can take at 0. Is that correct?  <response>: All that matters is when you realize the gain. As your edit deduces, you only get to take advantage of the 0 treatment on the gains that fill up the 15 bracket, you dont get an arbitrary amount of gain at 0.Yes, this would be a good strategy for someone in retirement to take advantage of. Though the 0 ltcg bracket is relatively new and I wouldnt plan my own retirement strategy around it still being there in 30 years. 