# How many valence electrons total?

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.

- Page: https://www.acalculator.org/chemistry/valence-electrons-calculator
- JSON spec: https://www.acalculator.org/chemistry/valence-electrons-calculator.json
- Version: d6e5919b3fe3

## Default answer

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

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| for | Count for | One element, or a whole molecule or ion (for a Lewis structure). |
| z | Element | The element, by atomic number, symbol and name. |
| f | Formula | A molecule or ion of main-group atoms, such as CO2, NH4^+ or SO4^2-. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| valence | Valence electrons | The valence electrons of the element, or the total for the molecule or ion. |
| rule | Counted as | Which electrons count, by the kind of element, or the sum over the atoms. |
| outer | Outer-shell s and p electrons | Electrons in the s and p subshells of the shell numbered as the element’s period. |
| configuration | Electron configuration | The ground-state configuration in noble-gas notation. |
| subject | For | The element or the formula. |
| words | In words | The count with its noun, such as 1 valence electron. |

## 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.

## Assumptions

- 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).

## Worked examples

1. for = element, z = 8 gives valence = 6, 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. for = element, z = 17 gives valence = 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. for = element, z = 31 gives valence = 3, 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. for = element, z = 26 gives valence = 8, outer = 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. for = formula, f = SiH4 gives valence = 8, rule = 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. for = formula, f = CHO2^- gives valence = 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. for = formula, f = NO^+ gives valence = 10, rule = 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. for = formula, f = XeF6 gives valence = 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.

## FAQ

### 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.

## Sources

- OpenStax, Chemistry 2e, §6.4 Electronic Structure of Atoms (Electron Configurations): valence electrons are those in the highest n shell for main-group elements, completely filled d orbitals count as core (gallium has three valence electrons), transition elements count the ns and (n − 1)d electrons, inner transition elements the (n − 2)f, (n − 1)d and ns, and fluorine and chlorine each have seven. https://openstax.org/books/chemistry-2e/pages/6-4-electronic-structure-of-atoms-electron-configurations (retrieved 2026-10-19)
- OpenStax, Chemistry 2e, §7.3 Lewis Symbols and Structures: total valence electrons for a Lewis structure, one less per positive charge and one more per negative charge, with SiH₄ 8, CHO₂⁻ 18, NO⁺ 10, OF₂ 20, HCN 10 and XeF₆ 50. https://openstax.org/books/chemistry-2e/pages/7-3-lewis-symbols-and-structures (retrieved 2026-10-19)
- OpenStax, Chemistry 2e, §2.5 The Periodic Table: transition metals in groups 3 to 12, lanthanides 57 to 71 and actinides 89 to 103. https://openstax.org/books/chemistry-2e/pages/2-5-the-periodic-table (retrieved 2026-10-19)
- NIST Standard Reference Database 111, Ground Levels and Ionization Energies for the Neutral Atoms: ground-state configurations for Z = 1 to 108, in its HTML table in the NIST Atomic Spectra Database. https://www.nist.gov/pml/ground-levels-and-ionization-energies-neutral-atoms (retrieved 2026-10-19)
