Diazomethane is a yellow, poisonous, potentially explosive compound with the chemical formula CH2N2. It is a valuable synthetic reagent that is used for methylation reactions and in the synthesis of heterocyclic compounds. Diazomethane can be prepared through Pechmann's method involving the reaction of methylamine with ethyl chlorofomate or through hydrolysis of an ethereal solution of an N-methyl nitrosamide with aqueous base. It is chemically very reactive and transforms functional groups, making it useful for a variety of synthetic applications.