The replacement of hydrogen atom(s) in an aliphatic or aromatic hydrocarbon by halogen atom(s) results in the formation of alkyl halide (haloalkane) and aryl halide (haloarene), respectively.
Compounds are classified depending on whether they contain one, two, or more halogen atoms in their structures:
Halogen atoms are more electronegative than carbon, making the carbon-halogen bond highly polarized. The carbon atom bears a partial positive charge ($\delta+$) while the halogen atom bears a partial negative charge ($\delta-$).
The hydroxyl group of an alcohol is replaced by halogen using various reagents:
Aryl chlorides and bromides are prepared by direct halogenation of arenes with chlorine or bromine in the presence of a Lewis acid catalyst like iron or iron(III) chloride ($FeCl_3$) in the dark.
When a primary aromatic amine dissolved in cold aqueous mineral acid is treated with sodium nitrite ($NaNO_2$), a diazonium salt is formed. Shaking the freshly prepared diazonium salt with cuprous chloride or cuprous bromide results in the replacement of the diazonium group by $-Cl$ or $-Br$.
A nucleophile attacks the electron-deficient carbon bonded to the halogen, displacing the halide ion (leaving group):
$$Nu^- + C^{\delta+}-X^{\delta-} \rightarrow C-Nu + X^-$$When a haloalkane with a $\beta$-hydrogen atom is heated with an alcoholic solution of potassium hydroxide ($KOH$), elimination of a hydrogen atom from the $\beta$-carbon and a halogen atom from the $\alpha$-carbon occurs, forming an alkene.
Aryl halides are extremely unreactive towards nucleophilic substitution due to:
Dow's Process (Drastic Conditions): Chlorobenzene can be converted to phenol under high temperature and pressure: $$\text{Chlorobenzene} \xrightarrow{\text{(i) NaOH, 623K, 300 atm, (ii) } H^+} \text{Phenol}$$ The presence of electron-withdrawing groups (like $-NO_2$) at ortho- and para-positions significantly increases the reactivity of haloarenes.
The halogen atom on the benzene ring is deactivating but $o, p$-directing due to resonance.
Carbon compounds containing more than one halogen atom are called polyhalogen compounds. Key examples include: