The rules for writing the distribution of electrons in various shell are given below:
1. If n gives the number of orbit or energy level, then 2n2 gives the maximum number of electrons possible in a given orbit or energy level. Thus K shell can have a maximum of 2 electrons, L shell can have a maximum of 8 electrons and M-shell can have a maximum of 18 electrons.
2. If it is the outermost orbit, then it should not have more than 8 electrons.
3. There should be stepwise filling of electrons in different orbits, i.e. electrons are not accomodated in a given orbit if the earlier orbits or shells are incompletely filled.