How many electrons can each shell in an atom hold? I know that the first shell can hold up to 2, the second and third can hold up to 8, and the fourth 18. But what about after that?
$$\text{Electron Capacity for a shell} = 2n^2$$

where, n represents the Principal Quantum Number, a.k.a. energy level.

Keep in mind that an energy level need not be completely filled before electrons begin to fill the next level because beyond the fourth energy level, you would get into theoretical subshells.

See this.