What is the 5-year rule for roth 401k?

No, if you haven't maintained the account for more than 5 years or if the distribution doesn't take place after a death, disability, or age 59 and a half, then the distribution is not a qualified distribution. However, you can transfer the distribution to a designated Roth account from another plan or to your Roth IRA. Those who convert traditional IRAs to Roth IRAs are subject to a completely different set of rules to ensure that they don't just convert to Roth to avoid early withdrawal penalties. If the transfer is not direct (the funds are distributed to the account holder and not from one institution to another), the funds must be deposited in another Roth 401 (k) or Roth IRA account within 60 days to avoid taxes.

Even if you don't have a Roth IRA right now, the transfer of a qualified Roth 401 (k) will be considered a regular contribution to a Roth IRA. Currently, it's possible to convert a traditional IRA to a Roth IRA even if you exceed income limits (although the law that allows it may change in the future). So to answer your first question, yes, it might make sense to open a Roth IRA at least five years before you plan to transfer your Roth 401 (k).