The Nierenstein reaction is an organic reaction describing the conversion of an acid chloride into a haloketone with diazomethane. It is an insertion reaction in that the methylene group from the diazomethane is inserted into the carbon-chlorine bond of the acid chloride.

Reaction mechanism
The reaction proceeds through a diazonium salt intermediate formed by nucleophilic acyl substitution of the chloride with diazomethyl anion. The chloride then displaces the diazo group in an SN2 reaction, with N2 as the leaving group.

If excess diazomethane is present during the reaction, it can act as a base, abstracting a hydrogen from the diazonium-salt intermediate. The result is a neutral diazoketone, which does not react with the chloride. Instead, the byproduct, diazonium-methyl from the other diazomethane molecule, can be attacked by the chloride to produce chloromethane. The unreactive diazoketone can be re-activated and reacted by treatment with hydrogen chloride to give the normal Nierenstein product.

In some cases, even limiting the amount of diazomethane gives a reaction process that stalls via the neutral diazoketone pathway, requiring the addition of HCl gas to rescue it.

Scope
One original 1924 Nierenstein reaction:

and a reaction starting from benzoyl bromide going haywire with formation of the dioxane dimer:

See also 
 Maximilian Nierenstein
 Curtius rearrangement
 Wolff rearrangement
 Arndt–Eistert reaction: where acid chlorides react with diazomethane to give chain extended carboxylic acids via a rearrangement

References

Substitution reactions
Name reactions