Electron configuration
In atomic physics and quantum chemistry, the electron configuration is the arrangement of electrons in an atom, molecule, or other physical structure (e.g., a crystal).
Like other elementary particles, the electron is subject to the laws of quantum mechanics, and exhibits both particle-like and wave-like nature. Formally, the quantum state of a particular electron is defined by its wavefunction, a complex-valued function of space and time. According to the Copenhagen interpretation of quantum mechanics, the position of a particular electron is not well defined until an act of measurement causes it to be detected. The probability that the act of measurement will detect the electron at a particular point in space is proportional to the square of the absolute value of the wavefunction at that point.
Electrons are able to move from one energy level to another by emission or absorption of a quantum of energy, in the form of a photon.  Because of the Pauli exclusion principle, no more than two electrons may exist in a given atomic orbital; therefore an electron may only leap to another orbital if there is a vacancy there.
Knowledge of the electron configuration of different atoms is useful in understanding the structure of the periodic table of elements. The concept is also useful for describing the chemical bonds that hold atoms together. In bulk materials this same idea helps explain the peculiar properties of lasers and semiconductors.

# Electron configuration in atoms
The discussion below presumes knowledge of material contained at Atomic orbital.

## Summary of the quantum numbers
The state of an electron in an atom is given by four quantum numbers. Three of these are integers and are properties of the atomic orbital in which it sits (a more thorough explanation is given in that article).
No two electrons in one atom can have the same set of these four quantum numbers (Pauli exclusion principle).

## Shells and subshells
Shells and subshells (also called energy levels and sublevels) are defined by the quantum numbers, not by the distance of its electrons from the nucleus, or even their overall energy.  In large atoms, shells above the second shell overlap (see Aufbau principle).
States with the same value of n are related, and said to lie within the same electron shell.
States with the same value of n and also l are said to lie within the same electron subshell, and those electrons having the same n and l are called equivalent electrons.
If the states also share the same value of m, they are said to lie in the same atomic orbital.
Because electrons have only two possible spin states, an atomic orbital cannot contain more than two electrons (Pauli exclusion principle).
A subshell can contain up to 4l+2 electrons; a shell can contain up to 2n2 electrons; where n equals the shell number.

### Worked example
Here is the electron configuration for a filled fifth shell:
This information can be written as 5s2 5p6 5d10 5f14 5g18 (see below for more details on notation).

## Notation
Physicists and chemists use a standard notation to describe atomic electron configurations. In this notation, a subshell is written in the form nxy, where n is the shell number, x is the subshell label and y is the number of electrons in the subshell. An atom's subshells are written in order of increasing energy  in other words, the sequence in which they are filled (see Aufbau principle below).
For instance, ground-state hydrogen has one electron in the s orbital of the first shell, so its configuration is written 1s1. Lithium has two electrons in the 1s subshell and one in the (higher-energy) 2s subshell, so its ground-state configuration is written 1s2 2s1.  Phosphorus (atomic number 15), is as follows: 1s2 2s2 2p6 3s2 3p3.
For atoms with many electrons, this notation can become lengthy.  It is often abbreviated by noting that the first few subshells are identical to those of one or another noble gas.  Phosphorus, for instance, differs from neon (1s2 2s2 2p6) only by the presence of a third shell.  Thus, the electron configuration of neon is pulled out, and phosphorus is written as follows: 3s2 3p3.
An even simpler version is simply to quote the number of electrons in each shell, e.g. (again for phosphorus): 2-8-5.
The orbital labels s, p, d, and f originate from a now-discredited system of categorizing spectral lines as sharp, principal, diffuse, and fundamental, based on their observed fine structure. When the first four types of orbitals were described, they were associated with these spectral line types, but there were no other names. The designation g was derived by following alphabetical order. Shells with more than five subshells are theoretically permissible, but this covers all discovered elements. For mnemonic reasons, some call the s and p orbitals spherical and peripheral.

## Aufbau principle
In the ground state of an atom (the condition in which it is ordinarily found), the electron configuration generally follows the Aufbau principle.  According to this principle, electrons enter into states in order of the states' increasing energy; i.e., the first electron goes into the lowest-energy state, the second into the next lowest, and so on. The order in which the states are filled is as follows:
The order of increasing energy of the subshells can be constructed by going through downward-leftward diagonals of the table above (also see the diagram at the top of the page), going from the topmost diagonals to the bottom. The first (topmost) diagonal goes through 1s; the second diagonal goes through 2s; the third goes through 2p and 3s; the fourth goes through 3p and 4s; the fifth goes through 3d, 4p, and 5s; and so on. In general, a subshell that is not "s" is always followed by a "lower" subshell of the next shell; e.g. 2p is followed by 3s; 3d is followed by 4p, which is followed by 5s, 4f is followed by 5d, which is followed by 6p, and then 7s. This explains the ordering of the blocks in the periodic table.
A pair of electrons with identical spins has slightly less energy than a pair of electrons with opposite spins.  Since two electrons in the same orbital must have opposite spins, this causes electrons to prefer to occupy different orbitals.  This preference manifests itself if a subshell with l>0 (one that contains more than one orbital) is less than full.  For instance, if a p subshell contains four electrons, two electrons will be forced to occupy one orbital, but the other two electrons will occupy both of the other orbitals, and their spins will be equal.  This phenomenon is called Hund's rule.
The Aufbau principle can be applied, in a modified form, to the protons and neutrons in the atomic nucleus (see the shell model of nuclear physics).

### Orbitals table
This table shows all orbital configurations up to 7s, therefore it covers the simple electronic configuration for all elements from the periodic table up to Ununbium (element 112) with the exception of Lawrencium (element 103), which would require a 7p orbital.

### Exceptions in 3d, 4d, 5d
A d subshell that is half-filled or full (ie 5 or 10 electrons) is more stable than the s subshell of the next shell.  This is the case because it takes less energy to maintain an electron in a half-filled d subshell than a filled s subshell.  For instance, copper (atomic number 29) has a configuration of 4s1 3d10, not 4s2 3d9 as one would expect by the Aufbau principle.  Likewise, chromium (atomic number 24) has a configuration of 4s1 3d5, not 4s2 3d4 where  represents the configuration for argon.
Exceptions in Period 4:
Exceptions in Period 5:
Exceptions in Period 6:

## Relation to the structure of the periodic table
Electron configuration is intimately related to the structure of the periodic table.  The chemical properties of an atom are largely determined by the arrangement of the electrons in its outermost "valence" shell (although other factors, such as atomic radius, atomic mass, and increased accessibility of additional electronic states also contribute to the chemistry of the elements as atomic size increases) therefore elements in the same table group are chemically similar because they contain the same number of "valence" electrons.

# Electron configuration in molecules
In molecules, the situation becomes more complex, as each molecule has a different orbital structure.  See the molecular orbital article and the linear combination of atomic orbitals method for an introduction and the computational chemistry article for more advanced discussions.

# Electron configuration in solids
In a solid, the electron states become very numerous.  They cease to be discrete, and effectively blend together into continuous ranges of possible states (an electron band).  The notion of electron configuration ceases to be relevant, and yields to band theory.