acalculator

How many valence electrons total?

Pick an element to count its valence electrons from its ground-state electron configuration, or type a molecule or ion such as CO2 or NH4^+ to get the total you need for its Lewis structure.

Your numbers

Count for
Valence electrons
6

Oxygen (O) has 6 valence electrons.

Counted as
Main-group element: the electrons in its outermost shell, n = 2: 2s² 2p⁴
Outer-shell s and p electrons
6
Electron configuration
[He] 2s² 2p⁴
For
Oxygen (O)
In words
6 valence electrons

Valence electrons: 6. Oxygen (O) has 6 valence electrons.

How to calculate

Counts the valence electrons of any element from its ground-state electron configuration, or the total valence electrons of a molecule or ion for drawing its Lewis structure.

Example with the default inputs (Count for An element, Element 8 O (Oxygen)): Oxygen (O) has 6 valence electrons.

Method: Element: main group, the s and p electrons of the outermost shell (n = period); groups 3 to 12, the ns and (n − 1)d electrons; lanthanides and actinides, every electron outside the noble-gas core. Molecule or ion: the sum of each main-group atom’s valence electrons × its count, minus the charge.

  • Neutral atoms in their ground state: NIST’s configuration for Z up to 108, the Madelung filling order beyond.
  • Lanthanides are La to Lu (57 to 71) and actinides Ac to Lr (89 to 103), as in OpenStax’s periodic table.
  • A molecule or ion may hold main-group atoms only (groups 1, 2 and 13 to 18, with hydrogen and helium).

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Count for An element, Element 8 O (Oxygen) gives Valence electrons 6, Electron configuration [He] 2s² 2p⁴.Source: OpenStax, Chemistry 2e, §6.4 Electronic Structure of Atoms (Electron Configurations) (valence electrons), https://openstax.org/books/chemistry-2e/pages/6-4-electronic-structure-of-atoms-electron-configurations: main-group valence electrons are those in the highest n level
  2. Count for An element, Element 17 Cl (Chlorine) gives Valence electrons 7.Source: OpenStax, Chemistry 2e, §6.4 Electronic Structure of Atoms (Electron Configurations) (valence electrons), https://openstax.org/books/chemistry-2e/pages/6-4-electronic-structure-of-atoms-electron-configurations: fluorine and chlorine each have seven valence electrons
  3. Count for An element, Element 31 Ga (Gallium) gives Valence electrons 3, Electron configuration [Ar] 3d¹⁰ 4s² 4p¹.Source: OpenStax, Chemistry 2e, §6.4 Electronic Structure of Atoms (Electron Configurations) (valence electrons), https://openstax.org/books/chemistry-2e/pages/6-4-electronic-structure-of-atoms-electron-configurations: gallium, [Ar]4s²3d¹⁰4p¹, has three valence electrons
  4. Count for An element, Element 26 Fe (Iron) gives Valence electrons 8, Outer-shell s and p electrons 2.Source: OpenStax, Chemistry 2e, §6.4 Electronic Structure of Atoms (Electron Configurations) (valence electrons), https://openstax.org/books/chemistry-2e/pages/6-4-electronic-structure-of-atoms-electron-configurations: transition elements count the ns and (n − 1)d electrons
  5. Count for A molecule or ion, Formula SiH4 gives Valence electrons 8, Counted as 4 (Si) + 4 × 1 (H) = 8.Source: OpenStax, Chemistry 2e, §7.3 Lewis Symbols and Structures (total valence electrons; subtract one per positive charge, add one per negative), https://openstax.org/books/chemistry-2e/pages/7-3-lewis-symbols-and-structures: SiH₄, 4 + 4(1) = 8 valence electrons
  6. Count for A molecule or ion, Formula CHO2^- gives Valence electrons 18.Source: OpenStax, Chemistry 2e, §7.3 Lewis Symbols and Structures (total valence electrons; subtract one per positive charge, add one per negative), https://openstax.org/books/chemistry-2e/pages/7-3-lewis-symbols-and-structures: CHO₂⁻, 4 + 1 + 2(6) + 1 = 18
  7. Count for A molecule or ion, Formula NO^+ gives Valence electrons 10, Counted as 5 (N) + 6 (O) − 1 (charge +1) = 10.Source: OpenStax, Chemistry 2e, §7.3 Lewis Symbols and Structures (total valence electrons; subtract one per positive charge, add one per negative), https://openstax.org/books/chemistry-2e/pages/7-3-lewis-symbols-and-structures: NO⁺, 5 + 6 − 1 = 10
  8. Count for A molecule or ion, Formula XeF6 gives Valence electrons 50.Source: OpenStax, Chemistry 2e, §7.3 Lewis Symbols and Structures (total valence electrons; subtract one per positive charge, add one per negative), https://openstax.org/books/chemistry-2e/pages/7-3-lewis-symbols-and-structures, Example 7.5: XeF₆, 8 + 6(7) = 50

How it works

Configuration. The neutral atom’s ground state: subshells filled in the Madelung order (1s 2s 2p 3s 3p 4s 3d 4p 5s 4d 5p 6s 4f 5d 6p 7s 5f 6d 7p, holding 2, 6, 10 and 14 electrons for s, p, d and f), replaced by NIST’s ground state for the 20 elements where it differs (the noble-gas core, then the subshells listed). Elements 109 to 118 use the filling order. It is shown in noble-gas notation in shell order.

ZElementNIST ground state
24Cr[Ar] 3d⁵ 4s¹
29Cu[Ar] 3d¹⁰ 4s¹
41Nb[Kr] 4d⁴ 5s¹
42Mo[Kr] 4d⁵ 5s¹
44Ru[Kr] 4d⁷ 5s¹
45Rh[Kr] 4d⁸ 5s¹
46Pd[Kr] 4d¹⁰
47Ag[Kr] 4d¹⁰ 5s¹
57La[Xe] 5d¹ 6s²
58Ce[Xe] 4f¹ 5d¹ 6s²
64Gd[Xe] 4f⁷ 5d¹ 6s²
78Pt[Xe] 4f¹⁴ 5d⁹ 6s¹
79Au[Xe] 4f¹⁴ 5d¹⁰ 6s¹
89Ac[Rn] 6d¹ 7s²
90Th[Rn] 6d² 7s²
91Pa[Rn] 5f² 6d¹ 7s²
92U[Rn] 5f³ 6d¹ 7s²
93Np[Rn] 5f⁴ 6d¹ 7s²
96Cm[Rn] 5f⁷ 6d¹ 7s²
103Lr[Rn] 5f¹⁴ 7s² 7p¹

Valence electrons of an element (OpenStax §6.4). Let n be the element’s period (1 to 7).

  • Main-group elements (groups 1, 2 and 13 to 18): the s and p electrons of shell n. Filled d and f subshells are core.
  • Transition elements (groups 3 to 12: Sc to Zn, Y to Cd, Hf to Hg, Rf to Cn): the ns and (n − 1)d electrons. Palladium, [Kr] 4d¹⁰, has 0 + 10 = 10.
  • Lanthanides and actinides (La to Lu, Ac to Lr): the (n − 2)f, (n − 1)d and ns electrons, counted as every electron outside the noble-gas core ([Xe] or [Rn]); lawrencium’s 7p¹ electron counts too. This is OpenStax’s definition; it gives lutetium 17, so the page names it in the result.

The page also gives the outer-shell s and p electrons (the s and p electrons of shell n) for every element.

Valence electrons of a molecule or ion (OpenStax §7.3). Each atom must be a main-group element; its valence electrons are counted as above. Total = Σ (atoms × valence electrons) − charge: one electron less for each positive charge and one more for each negative charge. The total is a whole number worked out exactly, however large the counts. Formulas are typed as in the oxidation number calculator: SO4^2-, SO₄²⁻, SO4 2- or OH-. Other spaces are ignored, and a charge after a space needs its sign (SO4 2 reads as SO₄₂). A digit just before a final sign (NO3-) is refused as ambiguous, and so are an empty formula, a formula with no element symbol, an empty bracket (Ca()2), a number in front of the formula (2CO2), an electron, a transition metal, lanthanide or actinide atom, and a charge that would leave a negative total.

Worked examples by hand

Oxygen. [He] 2s² 2p⁴; shell 2 holds 2 + 4 = 6 valence electrons.

Chlorine. [Ne] 3s² 3p⁵: 7.

Gallium. [Ar] 3d¹⁰ 4s² 4p¹: shell 4 holds 2 + 1 = 3; the 3d¹⁰ is core.

Iron. [Ar] 3d⁶ 4s², a transition element in period 4: 4s² + 3d⁶ = 8; its outer-shell s and p electrons are 2.

SiH₄. 4 + 4 × 1 = 8.

CHO₂⁻. 4 + 1 + 2 × 6 + 1 (charge −1) = 18.

NO⁺. 5 + 6 − 1 (charge +1) = 10.

XeF₆. 8 + 6 × 7 = 50.

Other questions people ask

How do I find the number of valence electrons?

For a main-group element, count the electrons in its outermost shell: the s and p electrons of the shell numbered like its period. Oxygen is [He] 2s² 2p⁴, so it has 6. For main-group elements this equals the last digit of the group number: group 1 has 1, group 14 has 4, group 17 has 7.

Do filled d electrons count?

Not for a main-group element. Gallium is [Ar] 3d¹⁰ 4s² 4p¹: the filled 3d subshell counts as core, so gallium has 3 valence electrons, like boron and aluminium.

How many valence electrons does a transition metal have?

OpenStax counts the ns and (n − 1)d electrons of a transition element. Iron, [Ar] 3d⁶ 4s², has 2 + 6 = 8; copper, [Ar] 3d¹⁰ 4s¹, has 11. The page also lists the outer-shell s and p electrons, 2 for iron.

How do I count the valence electrons of a molecule?

Add the valence electrons of every atom, subtract one for each positive charge and add one for each negative charge. CO₂: 4 + 2 × 6 = 16. NO⁺: 5 + 6 − 1 = 10. CHO₂⁻: 4 + 1 + 2 × 6 + 1 = 18. This total is the first step in drawing a Lewis structure.

Why does the page refuse a formula with iron in it?

The molecule count is for Lewis structures, which use main-group atoms (groups 1, 2 and 13 to 18, with hydrogen and helium). Transition metals and lanthanides and actinides are refused there; pick them one at a time as elements.

How many valence electrons do the lanthanides have?

OpenStax counts the (n − 2)f, (n − 1)d and ns electrons of an inner transition element, so the page counts every electron outside the noble-gas core: lanthanum [Xe] 5d¹ 6s² has 3, gadolinium [Xe] 4f⁷ 5d¹ 6s² has 10.