Skip to content

Electron Shell Calculator

Calculate electron shell with instant, accurate results and clear step-by-step output.

By CalcGenius Editorial TeamLast reviewed August 28, 20253 min read
Electron Shell Calculator
Positive integer: 1 (K), 2 (L), 3 (M), 4 (N), 5 (O), 6 (P), 7 (Q)...
The traditional letter name for the shell (K, L, M, ...).
📊
Enter your values and click Calculate

About

Electron shells are energy levels in an atom, identified by the principal quantum number n (a positive integer: 1, 2, 3, ...). The shell with n=1 is closest to the nucleus (lowest energy, smallest orbital), and successive shells are farther out and higher in energy. The letters K, L, M, N, O, P, Q (named by Charles Barkla in 1911) are traditional labels corresponding to n=1, 2, 3, 4, 5, 6, 7. The K shell holds the fewest electrons; the Q shell the most.

The maximum number of electrons that can occupy shell n is given by the simple formula 2n². For n=1: 2 electrons; n=2: 8; n=3: 18; n=4: 32; n=5: 50; n=6: 72; n=7: 98. This formula comes from two facts: each orbital can hold at most 2 electrons (Pauli exclusion principle), and a shell with principal quantum number n contains n² orbitals (the sum of (2l+1) for l = 0 to n−1, which equals n²). Multiplying: 2 × n² = 2n² maximum electrons.

Within each shell, electrons are further grouped into sub-shells identified by the azimuthal quantum number l, ranging from 0 to n−1. Sub-shell letters come from early spectroscopic notation: s (sharp, l=0), p (principal, l=1), d (diffuse, l=2), f (fundamental, l=3). After f, the letters continue alphabetically (g, h, i...) but are not needed for any known element. Each sub-shell type has a fixed number of orbitals: s has 1, p has 3, d has 5, f has 7 — corresponding to (2l+1) values of the magnetic quantum number m_l. Each orbital holds 2 electrons, giving sub-shell capacities of 2, 6, 10, 14 (for s, p, d, f).

The 2n² formula gives the absolute maximum capacity of a shell, but the actual fill order in atoms is governed by the Aufbau principle, which says orbitals fill in order of increasing energy — not strictly in order of n. Because of electron-electron interactions in multi-electron atoms, the 4s sub-shell has lower energy than 3d, so potassium (Z=19) and calcium (Z=20) fill 4s before scandium (Z=21) starts filling 3d. This means the third period of the periodic table has only 8 elements (Na through Ar) — the M shell's 3d sub-shell doesn't fill until period 4.

The periodic table's structure directly reflects shell filling. Period 1 (H, He): 1s² = 2 elements. Period 2 (Li-Ne): 2s²2p⁶ = 8 elements. Period 3 (Na-Ar): 3s²3p⁶ = 8 elements (3d waits). Period 4 (K-Kr): 4s²3d¹⁰4p⁶ = 18 elements. Period 5 (Rb-Xe): 5s²4d¹⁰5p⁶ = 18. Period 6 (Cs-Rn): 6s²4f¹⁴5d¹⁰6p⁶ = 32. Period 7 (Fr-Og): 7s²5f¹⁴6d¹⁰7p⁶ = 32. The block structure of the table (s-block groups 1-2, p-block 13-18, d-block 3-12, f-block lanthanides/actinides) reveals which sub-shell is being filled.

Shell capacity and sub-shell structure underlie all of chemistry. The number of valence electrons (electrons in the outermost shell) determines an element's chemical reactivity and group in the periodic table. Atoms tend to gain, lose, or share electrons to achieve a filled outer shell (the octet rule for main-group elements, the 18-electron rule for transition metals). Understanding shells and sub-shells is essential for predicting bonding, magnetism, color, and reactivity across the periodic table.

How to Use

  1. 1
    Enter the principal quantum number n
    Type a value from 1 to 7 (or higher). n=1 is the K shell (closest to nucleus), n=7 is the Q shell (outermost known shell).
  2. 2
    Read the maximum electrons
    The hero block shows the maximum electrons per shell = 2n². For n=1: 2; n=2: 8; n=3: 18; n=4: 32; etc.
  3. 3
    See the sub-shells
    Below the hero, the breakdown table lists the sub-shells present (s, p, d, f, g, h...), their orbital counts (2l+1), and electron capacities (2 × orbitals).
  4. 4
    Sanity-check against the periodic table
    Period lengths in the periodic table correspond to 2, 8, 8, 18, 18, 32, 32 elements. Note that the M shell has 18 capacity but period 3 has only 8 elements — 4s fills before 3d.
  5. 5
    Explore higher shells
    For n=4 you get s+p+d+f (capacities 2+6+10+14=32). For n=5, add g sub-shell (capacity 18, total 50). For n=6, add h (capacity 22, total 72).

Formula

Maximum electrons per shell (2n² rule):

Max electrons in shell n = 2 × n²
n = 1 → 2 electrons (K)
n = 2 → 8 electrons (L)
n = 3 → 18 electrons (M)
n = 4 → 32 electrons (N)
n = 5 → 50 electrons (O)
n = 6 → 72 electrons (P)
n = 7 → 98 electrons (Q)

Sub-shells within shell n:

  • l = 0 to n−1, with letters s, p, d, f, g, h...
  • Orbitals per sub-shell: 2l+1 (s=1, p=3, d=5, f=7, g=9)
  • Capacity per sub-shell: 2 × (2l+1) (s=2, p=6, d=10, f=14)
  • Total orbitals in shell: Σ(2l+1) for l=0 to n−1 = n²
  • Total electrons in shell: 2 × n² = 2n² (when fully filled)

Worked Example

How many electrons can the N shell (n=4) hold?

  • n = 4, so l ranges 0 to 3 → sub-shells s, p, d, f
  • Sub-shell capacities: s=2, p=6, d=10, f=14
  • Total = 2 + 6 + 10 + 14 = 32 electrons
  • Formula check: 2n² = 2 × 16 = 32 ✓
  • Orbital count: 1 + 3 + 5 + 7 = 16 orbitals (= n²)

Period 6 of the periodic table fills which sub-shells?

  • Period 6 = Cs (Z=55) to Rn (Z=86), 32 elements
  • Sub-shells: 6s² (Cs, Ba), 4f¹⁴ (lanthanides), 5d¹⁰ (Hf-Hg), 6p⁶ (Tl-Rn)
  • Total electrons added in period 6: 2 + 14 + 10 + 6 = 32
  • Period length matches number of electrons added — that's why period 6 has 32 elements.

Tips

  • The 2n² formula gives the absolute maximum capacity of a shell, but the actual fill order means period lengths are 2, 8, 8, 18, 18, 32, 32 — not 2, 8, 18, 32, 50, 72, 98.
  • Sub-shell names s, p, d, f come from early spectroscopy: sharp, principal, diffuse, fundamental. After f, they continue g, h, i, k (j is skipped to avoid confusion with i in some notations).
  • Each orbital in a sub-shell has a distinct magnetic quantum number m_l (from −l to +l in integer steps). The s sub-shell (l=0) has just one orbital; p (l=1) has three (px, py, pz); d has five; f has seven.
  • The shell letters K, L, M, N, O, P, Q come from Charles Barkla's 1911 X-ray absorption studies, before quantum numbers were understood. He started at K to leave room for hypothetical inner shells that were never found.
  • Even though shell n=7 can hold 98 electrons, only 7s²7p⁶ is needed for known elements (through Z=118, oganesson). The 7d and 5f sub-shells fill but 7d, 7f, 7g, 7h, 7i remain empty — they would require Z up to 168+ to start filling.

Common Mistakes

Common mistakes
  • Assuming period length equals 2n² for the corresponding n. Period 3 has 8 elements, not 18 — the 3d sub-shell waits until period 4 because 4s is lower in energy.
  • Confusing shell capacity (2n²) with sub-shell capacity (2(2l+1)). A sub-shell is a subset of a shell.
  • Forgetting that sub-shells within shell n include l = 0 to n−1, not l = 0 to n. So shell 4 has s, p, d, f (l=0,1,2,3), not s, p, d, f, g.
  • Treating g, h sub-shells as fictional — they exist mathematically for n ≥ 5 (g), n ≥ 6 (h). They simply don't fill in any known element's ground state.
  • Assuming the 2n² rule gives the actual number of electrons in a shell for a given atom. It gives the MAXIMUM; the actual number depends on the element's Z and Aufbau fill order.

Frequently Asked Questions

What is an electron shell?
An electron shell is a group of atomic orbitals sharing the same principal quantum number n. The shell with n=1 is called the K shell, n=2 the L shell, n=3 the M shell, n=4 the N shell, and so on (letters were assigned by Charles Barkla before quantum numbers were understood, using K, L, M, N, O, P, Q). Each shell contains sub-shells (s, p, d, f, ...) characterized by the azimuthal quantum number l, ranging from 0 to n−1.
What is the 2n² rule for the maximum number of electrons per shell?
The maximum number of electrons that can occupy a shell with principal quantum number n is 2n². For n=1 (K): 2 electrons. For n=2 (L): 8. For n=3 (M): 18. For n=4 (N): 32. For n=5 (O): 50. For n=6 (P): 72. For n=7 (Q): 98. This rule comes from counting all the orbitals in the shell (each with capacity 2): sum of (2l+1) orbitals for l = 0 to n−1 = n² orbitals, times 2 electrons each = 2n².
What are sub-shells (s, p, d, f)?
Sub-shells are groups of orbitals within a shell, characterized by the azimuthal (angular momentum) quantum number l. Sub-shell letters come from early spectroscopic notation: s (sharp, l=0), p (principal, l=1), d (diffuse, l=2), f (fundamental, l=3). Beyond f, the letters continue alphabetically (g, h, ...) but are rarely needed for known elements. Each sub-shell type has a fixed number of orbitals: s has 1, p has 3, d has 5, f has 7 — corresponding to (2l+1) orbitals. Each orbital holds 2 electrons, so sub-shell capacities are 2, 6, 10, 14 (for s, p, d, f).
Why are there 2, 8, 8, 18, 18, 32... electrons in the periodic table periods?
The Aufbau fill order (1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, 5s, 4d, 5p, 6s, 4f, 5d, 6p, 7s, 5f, 6d, 7p) means that the 4s sub-shell fills before 3d, so period 4 ends with 4s²3d¹⁰4p⁶ = 18 elements (not 32). Period 1 (1s²): 2 elements. Period 2 (2s²2p⁶): 8. Period 3 (3s²3p⁶): 8 — note 3d doesn't fill until period 4. Period 4 (4s²3d¹⁰4p⁶): 18. Period 5 (5s²4d¹⁰5p⁶): 18. Period 6 (6s²4f¹⁴5d¹⁰6p⁶): 32. Period 7 (7s²5f¹⁴6d¹⁰7p⁶): 32.
Why doesn't the 3rd shell hold 18 electrons in the periodic table?
Because the 4s sub-shell has lower energy than 3d once you reach argon (Z=18), so after 3p fills (Ar), the next electrons go into 4s (K, Ca) rather than 3d. So period 3 ends at argon with only 3s²3p⁶ = 8 electrons in the M shell — the 3d sub-shell waits until period 4 to fill (Sc to Zn). This is why the periodic table has 8 elements in period 3 even though the M shell can hold 18. Once 3d fills (period 4), the M shell's 3d sub-shell completes its 18-electron capacity.
How many sub-shells can exist in principle?
Mathematically, infinitely many — the principal quantum number n can be any positive integer, and each shell can have l = 0 to n−1 sub-shells. In practice, only n=1 through n=7 are needed for the 118 known elements (highest Z=118, oganesson, fills 7p⁶). For very high n (Rydberg states in hydrogen), shells can extend to n=100+. The sub-shell letters after f (l=3) follow g, h, i, j... (skipping j historically), but no element needs beyond f in its ground state.

Principal quantum number n

The principal quantum number n (a positive integer: 1, 2, 3, ...) identifies an electron shell in an atom. It is the most important quantum number — it largely determines the electron's energy and average distance from the nucleus. Larger n means higher energy, larger orbital, and farther average distance. The shell with n=1 is called the K shell (innermost), n=2 the L shell, n=3 the M shell, and so on alphabetically through Q (n=7). The letters come from Charles Barkla's early X-ray spectroscopy work, predating quantum numbers themselves.

2n² rule

The maximum number of electrons that fit in shell n is 2n². For n=1: 2; n=2: 8; n=3: 18; n=4: 32; n=5: 50; n=6: 72; n=7: 98. The formula comes from counting all orbitals in the shell: each orbital holds 2 electrons (Pauli exclusion), and a shell n contains n² orbitals (sum of (2l+1) for l = 0 to n−1 = n²). So 2n² electrons maximum. This rule, plus the Aufbau fill order (4s before 3d), explains the structure of the periodic table — though the actual fill order means periods have 2, 8, 8, 18, 18, 32, 32 elements, not 2, 8, 18, 32, 50, 72, 98.

Sub-shells (s, p, d, f)

Within each shell, electrons are further organized into sub-shells identified by the azimuthal quantum number l (0 to n−1). The sub-shell letters s, p, d, f come from early spectroscopic notation (sharp, principal, diffuse, fundamental). Each sub-shell has (2l+1) orbitals: s has 1, p has 3, d has 5, f has 7. Each orbital holds 2 electrons, so sub-shell capacities are s=2, p=6, d=10, f=14 (summing to 2n² per shell when all sub-shells up to l=n−1 are present). Beyond f come g, h, i... (capacity 18, 22, 26...), but no known element needs them in its ground state.

Periodic table structure

The periodic table's rows (periods) correspond to filling successive shells. Period 1 (H, He): 1s² = 2 elements. Period 2 (Li-Ne): 2s²2p⁶ = 8. Period 3 (Na-Ar): 3s²3p⁶ = 8 (3d waits until period 4 because 4s is lower energy). Period 4 (K-Kr): 4s²3d¹⁰4p⁶ = 18. Period 5 (Rb-Xe): 5s²4d¹⁰5p⁶ = 18. Period 6 (Cs-Rn): 6s²4f¹⁴5d¹⁰6p⁶ = 32. Period 7 (Fr-Og): 7s²5f¹⁴6d¹⁰7p⁶ = 32. The blocks (s-block, p-block, d-block, f-block) of the periodic table are labeled by which sub-shell is being filled.

Maximum capacity per shell and the breakdown by sub-shell — the 2n² rule applied to shells 1 through 7.
Shell nMax e⁻ (2n²)Sub-shells countSub-shell namesTotal orbitalsSub-shell capacities
1 (K)211s12
2 (L)822s, 2p1 + 3 = 42 + 6 = 8
3 (M)1833s, 3p, 3d1 + 3 + 5 = 92 + 6 + 10 = 18
4 (N)3244s, 4p, 4d, 4f1 + 3 + 5 + 7 = 162 + 6 + 10 + 14 = 32
5 (O)5055s, 5p, 5d, 5f, 5g1+3+5+7+9 = 252+6+10+14+18 = 50
6 (P)7266s, 6p, 6d, 6f, 6g, 6h1+3+5+7+9+11 = 362+6+10+14+18+22 = 72
7 (Q)9877s, 7p, 7d, 7f, 7g, 7h, 7i1+3+5+7+9+11+13 = 492+6+10+14+18+22+26 = 98
Why the periodic table has 7 periods
The 7 periods of the periodic table correspond to filling the 7 known shells. Hydrogen and helium (period 1) fill the K shell (1s). Period 2 fills L (2s, 2p). Period 3 fills the M sub-shells up to 3p (3d waits — that's why period 3 has only 8 elements, not 18). Period 4 finishes M (3d) and starts N (4s, 4p). Period 5 finishes parts of N (4d) and starts O (5s, 5p). Period 6 finishes N (4f, 5d) and starts P (6s, 6p). Period 7 finishes O (5f, 6d) and starts Q (7s, 7p). The 118 known elements fit into these 7 periods; an "extended" period 8 would begin filling 8s and would require the synthesis of superheavy elements beyond Z=118.

Authoritative References

Try our other free calculators

CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.

Compare Electron Shell — Side-by-Side Numbers & Key Totals