# Diazomethane

Diazomethane is an organic chemical compound with the formula CH$_2$N$_2$, discovered by German chemist Hans von Pechmann in 1894. It is the simplest diazo compound. In the pure form at room temperature, it is an extremely sensitive explosive yellow gas; thus, it is almost universally used as a solution in diethyl ether. The compound is a popular methylating agent in the laboratory, but it is too hazardous to be employed on an industrial scale without special precautions. Use of diazomethane has been significantly reduced by the introduction of the safer and equivalent reagent trimethylsilyldiazomethane.

## Use

For safety and convenience diazomethane is always prepared as needed as a solution in ether and used as such. It converts carboxylic acids to methyl esters and phenols into their methyl ethers. The reaction is thought to proceed via proton transfer from carboxylic acid to diazomethane to give a methyldiazonium cation, which reacts with the carboxylate ion to give the methyl ester and nitrogen gas. Labeling studies indicate that the initial proton transfer is faster than the methyl transfer step. Since proton transfer is required for the reaction to proceed, this reaction is selective for the more acidic carboxylic acids (pK$_a$ ~ 5) and phenols (pK$_a$ ~ 10) over aliphatic alcohols (pK$_a$ ~ 15).
In more specialized applications, diazomethane and other diazoalkyl reagents are used in the Arndt–Eistert reaction and the Büchner–Curtius–Schlotterbeck reaction for homologation of various compounds.
Diazomethane reacts with alcohols or phenols in presence of boron trifluoride (BF$_3$) to give methyl ethers.
Diazomethane is also frequently used as a carbene source. It readily takes part in 1,3-dipolar cycloadditions.

## Preparation
### Laboratory scale

A wide variety of routes have been developed for the laboratory production of diazomethane. In general, the synthesis of these all involves the addition of methylamine to an electron-deficient species, before treatment with nitrite and mineral acid (nitrous acid) to form an N-methyl nitrosamide. Diazomethane is prepared by hydrolysis of an ethereal solution of these N-methyl nitrosamides with aqueous base. Examples include:
* N-nitroso-N-methylurea (NMU), the original precursor first reported by Hans von Pechmann in 1894 and historically one of the most popular choices. Its popularity has slowly waned due to it being unstable at above 20 °C and somewhat shock-sensitive.
* N-Nitroso-β-methylaminoisobutyl methyl ketone (Liquizald), another early precursor which remains in use in the present day.
* N,N'-dimethyl-N,N'-dinitrosoterephthalamide (DMDMT)
* N-methyl-N'-nitro-N-nitrosoguanidine (MNNG), used as both a biochemical tool and a diazomethane source.
* N-methyl-N-nitroso-p-toluenesulfonamide (Diazald), one of the most popular modern precursors.
    Common routes for the preparation of diazomethane: Diazald (top), MNNG (bottom)
Diazomethane reacts with alkaline solutions of D$_2$O to give the deuterated derivative CD$_2$N$_2$. This can be used for isotopic labeling studies.

### Industrial use

The ease with which diazomethane explodes makes it too hazardous to handle in large quantities. Despite this, it can be used on an industrial scale using on-demand flow chemistry. In these processes the rate of production is matched by the rate of consumption, such that the amount of diazomethane present at any one time is very low.

### Analysis

The concentration of CH$_2$N$_2$ can be determined in either of two convenient ways. It can be treated with an excess of benzoic acid in cold Et$_2$O. Unreacted benzoic acid is then back-titrated with standard NaOH. Alternatively, the concentration of CH$_2$N$_2$ in Et$_2$O can be determined spectrophotometrically at 410 nm where its extinction coefficient, ε, is 7.2. The gas-phase concentration of diazomethane can be determined using photoacoustic spectroscopy.

## Related compounds

Diazomethane is both isomeric and isoelectronic with the more stable cyanamide, but they do not interconvert. Many substituted derivatives of diazomethane have been prepared:
* The very stable (CF$_3$)$_2$CN$_2$ (2-diazo-1,1,1,3,3,3-hexafluoropropane; b.p. 12–13 °C),
* Ph$_2$CN$_2$ (diazodiphenylmethane; m.p. 29–30 °C).
* (CH$_3$)$_3$SiCHN$_2$ (trimethylsilyldiazomethane), which is commercially available as a solution and is as effective as CH$_2$N$_2$ for methylation.
* PhC(H)N$_2$, a red liquid b.p.< 25 °C at 0.1 mmHg.

## Safety

Diazomethane is toxic by inhalation or by contact with the skin or eyes (TLV 0.2 ppm). Symptoms include chest discomfort, headache, weakness and, in severe cases, collapse. Symptoms may be delayed. Deaths from diazomethane poisoning have been reported. In one instance a laboratory worker consumed a hamburger near a fumehood where he was generating a large quantity of diazomethane, and died four days later from fulminating pneumonia. Like any other alkylating agent it is expected to be carcinogenic, but such concerns are overshadowed by its serious acute toxicity.
CH$_2$N$_2$ may explode in contact with sharp edges, such as ground-glass joints, even scratches in glassware. Glassware should be inspected before use and preparation should take place behind a blast shield. Specialized kits to prepare diazomethane with flame-polished joints are commercially available.
The compound explodes when heated beyond 100 °C, exposed to intense light, alkali metals, or calcium sulfate. Use of a blast shield is highly recommended while using this compound.
Proof-of-concept work has been done with microfluidics, in which continuous point-of-use synthesis from N-methyl-N-nitrosourea and 0.93 M potassium hydroxide in water was followed by point-of-use conversion with benzoic acid, resulting in a 65% yield of the methyl benzoate ester within seconds at temperatures ranging from 0 to 50 °C. The yield was better than under capillary conditions; the microfluidics were credited with "suppression of hot spots, low holdup, isothermal conditions, and intensive mixing."

## Isomers

The stable compound cyanamide, whose minor tautomer is carbodiimide, is an isomer of diazomethane. Less stable but still isolable isomers of diazomethane include the cyclic 3H-diazirine and isocyanoamine (isodiazomethane). In addition, the parent nitrilimine has been observed under matrix isolation conditions.