The s subshell has 2 electrons.
The p subshell can have 6.
The d subshell can have 10.
The f subshell can have 14.
This is partially due to the orbitals becoming more complex as they go down so can have more possible orientations in space. For instance, an s subshell is just a sphere so can only have 1 orientation in space so can have 1 orbital with 2 electrons, while p subshells are figures of eight so can be rotated 3 different ways along x,y,z planes, so ca have 3 orbitals.
d subshells are yet more complex and have 5 orbitals with 10 electrons, while f can have 7 orbitals with 14 electrons.
You can have 2 electrons per orbital due to spin and the Pauli exclusion principle - no two fermions may have the same quantum numbers in the same place, so in the same orbital the two electrons must have different spins to obey Pauli exclusion. One has a +12 spin and one has a −12 spin.