text: 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 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 ~ 5) and phenols (pK ~ 10) over aliphatic alcohols (pK ~ 15). 
  In more specialized applications, diazomethane and homologues are used in Arndt-Eistert synthesis and the Büchner–Curtius–Schlotterbeck reaction for homologation.
  Diazomethane reacts with alcohols or phenols in presence of boron trifluoride (BF) to give methyl ethers.
  Diazomethane is also frequently used as a carbene source. It readily takes part in 1,3-dipolar cycloadditions.