Haloform reaction Definition:
Addition of a dihalogen (such as iodine, bromine, or chlorine) to a methyl ketone in the presence of base results in a carboxylic acid and a haloform (iodoform, bromoform, or chloroform).
Haloform reaction Explained:
Haloform reaction is halogenation of a methyl ketone with excess halogen results in cleavage of a carbon-carbon σ bond and formation of two products, a carboxylate ion and CHX3 haloform. The mechanism of this reaction consists of two main phase.
In the first phase, the three hydrogen atoms of the methyl group are successively replaced by iodine via the two-step mechanism: deprotonation followed by halogenation to form the substitution product. Step  and step  is repeated for each substitution of hydrogen with iodine.
In the next phase, resulting intermediate is oxidatively cleaved with the base: The hydroxide ion function as a nucleophile and attacks the carbonyl group to makes the good leaving group -CI3. Elimination of the good leaving group results in cleavage of a carbon-carbon bond, and then in the last step, proton transfer forms the carboxylate anion and iodoform. The carboxylate ion can be protonated to give the carboxylic acid.
This reaction is also known as iodoform test because only methyl ketones react with I2 and iodoform which is yellow solid. This is a common chemical method for detect methyl ketones.