rbynaker
Level 14

Pub 590B addresses this and details the ordering rules:

https://www.irs.gov/publications/p590b#en_US_2022_publink100089915

I love that we're halfway through Feb already and the 2023 pub hasn't been finalized yet.  I find the PDFs easier to read/follow (especially if you have to use one of the worksheets) so it might be easier to read here:

https://www.irs.gov/pub/irs-pdf/p590b.pdf

Jump to Roth IRAs starting on page 31.

Or if you can tolerate the watermark on every page you can read the 2023 draft here:

https://www.irs.gov/pub/irs-dft/p590b--dft.pdf