Valence electron

In chemistry and physics, a valence electron is an outer shell electron that is associated with an atom, and that can participate in the formation of a chemical bond if the outer shell is not closed; in a single covalent bond, both atoms in the bond contribute one valence electron in order to form a shared pair.
The presence of valence electrons can determine the element's chemical properties, such as its valence—whether it may bond with other elements and, if so, how readily and with how many. In this way, a given element's reactivity is highly dependent upon its electronic configuration. For a main-group element, a valence electron can exist only in the outermost electron shell; for a transition metal, a valence electron can also be in an inner shell. 
An atom with a closed shell of valence electrons (corresponding to an electron configuration s2p6 for main-group elements or d10s2p6 for transition metals) tends to be chemically inert. Atoms with one or two valence electrons more than a closed shell are highly reactive due to the relatively low energy to remove the extra valence electrons to form a positive ion. An atom with one or two electrons less than a closed shell is reactive due to its tendency either to gain the missing valence electrons and form a negative ion, or else to share valence electrons and form a covalent bond.
Similar to a core electron, a valence electron has the ability to absorb or release energy in the form of a photon. An energy gain can trigger the electron to move (jump) to an outer shell; this is known as atomic excitation. Or the electron can even break free from its associated atom's shell; this is ionization to form a positive ion. When an electron loses energy (thereby causing a photon to be emitted), then it can move to an inner shell which is not fully occupied.
Overview.
Electron configuration.
The electrons that determine valence – how an atom reacts chemically – are those with the highest energy. 
For a main-group element, the valence electrons are defined as those electrons residing in the electronic shell of highest principal quantum number n. Thus, the number of valence electrons that it may have depends on the electron configuration in a simple way. For example, the electronic configuration of phosphorus (P) is 1s2 2s2 2p6 3s2 3p3 so that there are 5 valence electrons (3s2 3p3), corresponding to a maximum valence for P of 5 as in the molecule PF5; this configuration is normally abbreviated to [Ne] 3s2 3p3, where [Ne] signifies the core electrons whose configuration is identical to that of the noble gas neon.
However, transition elements have partially filled ("n" − 1)d energy levels, that are very close in energy to the "n" level. So as opposed to main-group elements, a valence electron for a transition metal is defined as an electron that resides outside a noble-gas core. Thus, generally, the d electrons in transition metals behave as valence electrons although they are not in the outermost shell. For example, manganese (Mn) has configuration 1s2 2s2 2p6 3s2 3p6 4s2 3d5; this is abbreviated to [Ar] 4s2 3d5, where [Ar] denotes a core configuration identical to that of the noble gas argon. In this atom, a 3d electron has energy similar to that of a 4s electron, and much higher than that of a 3s or 3p electron. In effect, there are possibly seven valence electrons (4s2 3d5) outside the argon-like core; this is consistent with the chemical fact that manganese can have an oxidation state as high as +7 (in the permanganate ion: ).
The farther right in each transition metal series, the lower the energy of an electron in a d subshell and the less such an electron has valence properties. Thus, although a nickel atom has, in principle, ten valence electrons (4s2 3d8), its oxidation state never exceeds four. For zinc, the 3d subshell is complete in all known compounds, although it does contribute to the valence band in some compounds.
The d electron count is an alternative tool for understanding the chemistry of a transition metal.
The number of valence electrons.
The number of valence electrons of an element can be determined by the periodic table group (vertical column) in which the element is categorized. With the exception of groups 3–12 (the transition metals), the units digit of the group number identifies how many valence electrons are associated with a neutral atom of an element listed under that particular column.
Helium is an exception: despite having a 1s2 configuration with two valence electrons, and thus having some similarities with the alkaline earth metals with their ns2 valence configurations, its shell is completely full and hence it is chemically very inert and is usually placed in group 18 with the other noble gases.
Valence shell.
The valence shell is the set of orbitals which are energetically accessible for accepting electrons to form chemical bonds.
For main-group elements, the valence shell consists of the ns and np orbitals in the outermost electron shell. In the case of transition metals (the (n-1)d orbitals), and lanthanides and actinides (the (n-2)f and (n-1)d orbitals), the orbitals involved can also be in an inner electron shell. Thus, the "shell" terminology is a misnomer as there is no correspondence between the valence shell and any particular electron shell in a given element. A scientifically correct term would be "valence orbital" to refer to the energetically accessible orbitals of an element.
As a general rule, a main-group element (except hydrogen or helium) tends to react to form a s2p6 electron configuration. This tendency is called the octet rule, because each bonded atom has 8 valence electrons including shared electrons. Similarly, a transition metal tends to react to form a d10s2p6 electron configuration. This tendency is called the 18-electron rule, because each bonded atom has 18 valence electrons including shared electrons.
Chemical reactions.
The number of valence electrons in an atom governs its bonding behavior. Therefore, elements whose atoms can have the same number of valence electrons are grouped together in the periodic table of the elements.
The most reactive kind of metallic element is an alkali metal of group 1 (e.g., sodium or potassium); this is because such an atom has only a single valence electron; during the formation of an ionic bond which provides the necessary ionization energy, this one valence electron is easily lost to form a positive ion (cation) with a closed shell (e.g., Na+ or K+). An alkaline earth metal of Group 2 (e.g., magnesium) is somewhat less reactive, because each atom must lose two valence electrons to form a positive ion with a closed shell (e.g., Mg2+).
Within each group (each periodic table column) of metals, reactivity increases with each lower row of the table (from a light element to a heavier element), because a heavier element has more electron shells than a lighter element; a heavier element's valence electrons exist at higher principal quantum numbers (they are farther away from the nucleus of the atom, and are thus at higher potential energies, which means they are less tightly bound).
A nonmetal atom tends to attract additional valence electrons to attain a full valence shell; this can be achieved in one of two ways: An atom can either share electrons with a neighboring atom (a covalent bond), or it can remove electrons from another atom (an ionic bond). The most reactive kind of nonmetal element is a halogen (e.g., fluorine (F) or chlorine (Cl)). Such an atom has the following electron configuration: s2p5; this requires only one additional valence electron to form a closed shell. To form an ionic bond, a halogen atom can remove an electron from another atom in order to form an anion (e.g., F−, Cl−, etc.). To form a covalent bond, one electron from the halogen and one electron from another atom form a shared pair (e.g., in the molecule H–F, the line represents a shared pair of valence electrons, one from H and one from F).
Within each group of nonmetals, reactivity decreases with each lower rows of the table (from a light element to a heavy element) in the periodic table, because the valence electrons are at progressively higher energies and thus progressively less tightly bound. In fact, oxygen (the lightest element in group 16) is the most reactive nonmetal after fluorine, even though it is not a halogen, because the valence shell of a halogen is at a higher principal quantum number.
In these simple cases where the octet rule is obeyed, the valence of an atom equals the number of electrons gained, lost, or shared in order to form the stable octet. However, there are also many molecules which are exceptions, and for which the valence is less clearly defined.
Electrical conductivity.
Valence electrons are also responsible for the electrical conductivity of an element; as a result, an element may be classified as a metal, a nonmetal, or a semiconductor (or metalloid).
Metallic elements generally have high electrical conductivity when in the solid state. In each row of the periodic table, the metals occur to the left of the nonmetals, and thus a metal has fewer possible valence electrons than a nonmetal. However, a valence electron of a metal atom has a small ionization energy, and in the solid state this valence electron is relatively free to leave one atom in order to associate with another nearby. Such a "free" electron can be moved under the influence of an electric field, and its motion constitutes an electric current; it is responsible for the electrical conductivity of the metal. Copper, aluminium, silver, and gold are examples of good conductors.
A nonmetallic element has low electrical conductivity; it acts as an insulator. Such an element is found toward the right of the periodic table, and it has a valence shell that is at least half full (the exception is boron). Its ionization energy is large; an electron cannot leave an atom easily when an electric field is applied, and thus such an element can conduct only very small electric currents. Examples of solid elemental insulators are diamond (an allotrope of carbon) and sulfur.
A solid compound containing metals can also be an insulator if the valence electrons of the metal atoms are used to form ionic bonds. For example, although elemental sodium is a metal, solid sodium chloride is an insulator, because the valence electron of sodium is transferred to chlorine to form an ionic bond, and thus that electron cannot be moved easily.
A semiconductor has an electrical conductivity that is intermediate between that of a metal and that of a nonmetal; a semiconductor also differs from a metal in that a semiconductor's conductivity increases with temperature. The typical elemental semiconductors are silicon and germanium, each atom of which has four valence electrons. The properties of semiconductors are best explained using band theory, as a consequence of a small energy gap between a valence band (which contains the valence electrons at absolute zero) and a conduction band (to which valence electrons are excited by thermal energy).