Alkanes react with halogens mainly by substitution. In this type of reaction, one or more atoms or groups in a molecule are replaced by other atoms or groups. In the case of alkanes and halogens, a halogen atom substitutes a hydrogen atom in the alkane molecule, forming a halogenoalkane. The substitution occurs due to the greater reactivity of halogens compared to the alkane's carbon-hydrogen bonds. The process usually requires energy to initiate, such as heat or light. The reaction mechanism involves a free radical mechanism where the halogen molecule breaks into two halogen radicals, which react with alkane molecules to form alkyl radicals and hydrogen halides. The alkyl radicals react with halogen molecules to form halogenoalkanes and regenerate the halogen radicals, which continue the reaction.