Carboxylic Acid Derivatives

By James Ashenhurst

Diazomethane (CH2N2)

Last updated: May 25th, 2023 |

Reactions Of Diazomethane (CH2N2) And Their Mechanisms

  • Diazomethane is a useful (albeit highly toxic and potentially explosive) reagent for the conversion of carboxylic acids to methyl esters.
  • It can also be used for the one-carbon extension (“homologation”) of carboxylic acids via the Arndt-Eistert synthesis.
  • The excellent leaving group (N2) makes it a potential source of carbenes, which can be used for cyclopropanation of alkenes.
  • Diazomethane (CH2N2) is the simplest diazo compound. A gas at room temperature (boiling point -23°C) it is generally prepared and used as a dilute solution with specialized equipment (such as flame-polished joints) that minimizes the chance of explosion. A related (and safer) reagent, trimethylsilyldiazomethane (TMSCHN2) is increasingly used in place of diazomethane.

diazomethane structure properties and reactions

Table of Contents

    1. The Lewis Structure of Diazomethane (CH2N2)
    2. Conversion of Carboxylic Acids To Methyl Esters With Diazomethane
    3. Mechanism of Methyl Ester Formation
    4. “Homologation” of Carboxylic Acids Using Diazomethane in the Arndt-Eistert Synthesis
    5. Mechanism of the Arndt-Eistert Synthesis (and Wolff Rearrangement)
    6. Cyclopropanations With Diazomethane
    7. Summary
    8. Notes
    9. Quiz Yourself!
    10. (Advanced) References and Further Reading

1. The Lewis Structure of Diazomethane (CH2N2)

Diazomethane is the simplest diazo compound, consisting of a methylene carbon (CH2) bonded to dinitrogen (N).

Just for fun, before we go any further, see if you can draw a proper Lewis structure for diazomethane, CH2N2.

Click to Flip

Note the two important resonance forms of diazomethane. The key resonance form for our purposes is the one on the left (on the flip side of the quiz), where carbon bears a lone pair and a negative formal charge. The other two compounds shown on the right are also valid Lewis structures for CH2N2 but are not diazomethane. [Note 1]

This provides an important clue to the potential reactivity of diazomethane; it is nucleophilic on carbon, and is also a reasonably good base. (The pKa of its conjugate acid is about 10, similar to that of NH4(+), so diazomethane is about as basic as NH3. )

The other clue to the chemical behavior of diazomethane is found in that nitrogen-nitrogen triple bond, which is the ultimate reason why diazomethane is the source of so many laboratory horror stories.

(For an example, see this article: Diazomethane – How Not To Do It)

Good leaving groups are weak bases – and dinitrogen (N2) is one of the weakest bases of all. As you might well be aware, every nitrogen atoms’ goal in life is to regain the freedom it once had as a molecule of dinitrogen (N2) in the earth’s atmosphere – and in diazomethane, this can be attained merely through breaking of a single carbon-nitrogen bond.

This makes diazomethane very frisky, and highly unstable towards things we would ordinarily classify as innocuous, like ground-glass joints and metal syringe tips.

Furthermore, if jostled, shocked, heated, or even treated with strong enough ultraviolet light, diazomethane will rapidly and violently give off nitrogen gas.

For these reasons [and also that it is a yellow gas at room temperature (boiling point –23 °C)] it is generally prepared and handled as a dilute solution in a solvent such as ether using special equipment (i.e. flame-polished pipettes, and no ground glass joints). [Note 2]

And oh, by the way, it is also extremely toxic. (See Note 3 for some details on handling diazomethane).

So why bother using it at all?  (Because it’s the best!  Note 4 )

2. Conversion of Carboxylic Acids To Methyl Esters With Diazomethane

Well, carboxylic acids can be made into methyl esters by treating them with the reagent diazomethane, CH2N2.

reaction of diazomethane with carboxylic acids to give methyl esters

This is a very mild way of converting carboxylic acids into esters. Due to the aforementioned toxicity and explosive hazards of diazomethane, it’s usually done on small scale.

An alternative (and much safer) reagent, trimethylsilyldiazomethane (TMSCHN2) is increasingly used in place of CH2N2. (Note 5)

3. Carboxylic Acids To Methyl Esters With Diazomethane – Mechanism

The conversion of carboxylic acids to methyl esters is a two-step process.

In the first step, diazomethane, a weak base, is protonated on carbon to give H3C-N2(+). This is an example of a diazonium compound, which you may have encountered if you’ve covered the Sandmeyer and related reactions.

mechanism for the reaction of carboxylic acids with diazomethane to give methyl esters begin with protonation

Like most diazonium compounds, CH3-N2(+) doesn’t stick around for long. It quickly recombines with the resulting carboxylate anion in an SN2 reaction to give the methyl ester and liberates the molecule of N2 to join its brethren in the atmosphere.

Interestingly, while diazomethane reacts readily with carboxylic acids, it does not undergo reactions with alkyl alcohols such as ethanol and propanol.

Can you figure out why? (Hint: the pKa of H3C-N2(+) is about 10). (Note 6)

Click to Flip

4. “Homologation” Of Carboxylic Acids With Diazomethane Using the “Arndt-Eistert Synthesis”

Diazomethane is also used for a process called the homologation of carboxylic acids, which is a fancy term for “making them one carbon longer”.

In this way, one could start with, say, acetic acid (CH3COOH) and convert it to propanoic acid (CH3CH2COOH).

A handy trick!  (if you enjoy the smell of vomit – but I digress)

The source of the “extra” carbon is the CH2 of diazomethane. This process was developed about a hundred years ago and is often referred to the Arndt-Eistert synthesis.

scheme for arndt eistert reaction of carboxylic acids -homologation - bonds formed and broken

  • The process starts with an acid chloride (which can be made from the carboxylic acid through treatment with thionyl chloride, oxalyl chloride, PCl5 or similar reagents). (See article: Thionyl Chloride)
  • Then, diazomethane is added (usually at least two equivalents, although modern procedures require just one).
  • Heating (or more commonly, addition of a silver salt such as Ag2O) results in loss of nitrogen gas accompanied by a skeletal rearrangement known as the Wolff Rearrangement, giving an intermediate product known as a ketene.
  • Addition of water to the ketene gives the carboxylic acid.

5. Mechanism of the Arndt-Eistert Synthesis (and Wolff Rearrangement)

There are three main phases in the Arndt-Eistert synthesis.

The first is reaction of diazomethane with the acid halide to give a new species known as a diazoketone.

  • Acid halides readily undergo nucleophilic acyl substitution to give various carboxylic acid deriviates. (See article: Nucleophilic Acyl Substitution)
  • Diazomethane is a reasonably good nucleophile due to the presence of the lone pair on carbon.

So the first two steps are a relatively straightforward addition-elimination process that give a new diazonium compound.

We’re not quite done.

Being adjacent to the carbonyl (and to N2) the alpha carbon is reasonably acidic and can be deprotonated by excess diazomethane (or an external base such as calcium oxide, see here) to give an enolate. 

formation of diazoketone from acid halides reaction with diazomethane

The enolate is just one of three main resonance forms of this molecule, which is often referred to as a “diazoketone”.

Keep an eye on that “enolate” resonance form (far left), however.

The next step is where things get a little weird.

If you start by drawing that resonance form on the far left, you can imagine a process where

  • the C-O pi bond forms, while
  • the C-C bond breaks, and migrates to the adjacent carbon (similar to 1,2-hydride and 1,2-alkyl shifts), and
  • the C-N bond breaks, liberating N2

wolff rearrangment step of the arndt eistert synthesis of diazoketone

(This rearrangement bears a lot of similarities to the Curtius and Hofmann rearrangements – see article)

It can be helpful to draw an ugly looking version of this product first to get the connectivity right.

The product of this reaction is known as a ketene, which is something of an exotic species for introductory organic chemistry.

Ketenes are excellent electrophiles. The C=O carbon of ketenes undergo reactions with various nucleophiles to give carboxylic acid derivatives.

They will even react with weak nucleophiles like water, giving a carboxylic acid.

reaction of ketene with water to give carboxylic acid mechanism

Ketenes will similarly react with alcohols to give esters and amines to give amides.

6. Cyclopropanation with Diazomethane

One final application of diazomethane in introductory organic chemistry is as a source of carbenes.

Carbenes are divalent carbon atoms (i.e. bonded to two atoms) and possess two non-bonded electrons. Like carbocations, they have six valence electrons and are electron-deficient species.

When heated, treated with light, or even in the presence of certain metals, diazomethane will lose N2 to give “methylene carbene”, :CH2

loss of dinitrogen from diazomethane to give methylene carbene

In the presence of alkenes, carbenes will form cyclopropanes.

examples of cyclopropanation of alkenes using diazomethane

Rather than heat or light (which can be unselective), palladium and copper catalysts are often used for these reactions. (For a representative example see here. )

7. Summary

Diazomethane has its uses. In introductory organic chemistry, these are primarily:

  • Formation of methyl esters from carboxylic acids
  • In the formation of diazo ketones, and subsequent Wolff rearrangement
  • Cyclopropanation

It is, to say the least, highly unlikely that an undergraduate laboratory will be using diazomethane for any reason, as it is extremely toxic and potentially explosive. In the event that you are in the position of having to carry out a procedure with CH2N2, it should be done with the utmost care and only with proper training and equipment.


Note 1. The two other compounds are valid Lewis structures but are not diazomethane.

  • HN=C=NH is the simplest example of a carbodiimide, the most prominent example of which is dicyclohexylcyclodiimide (DCC).
  • The cyclic molecule is called diazirine. Like diazomethane, it can also lose N2 to give methylene carbene. Although it looks extremely unstable, it has been synthesized – see here (J. Am. Chem. Soc. 1962, 84, 1063).

Note 2. A common precursor for preparing diazomethane is through the basic decomposition of p-tolylsulfonylmethylnitrosamide, which is sold by Aldrich under the trade name, DIAZALD®. They also sell special kits for the preparation of diazomethane that have flame-polished glass joints. A representative procedure for making diazomethane is here.

Note 3: Tips on working with diazomethane.  Man, there are so many. Here’s one: don’t ever, ever work with diazomethane unless you have been trained by someone who has worked with it themselves. Although generally never used neat (it boils at –23 °C) and typically handled as a dilute solution in ether, diazomethane has a nasty tendency to explode when in the presence of high-surface-area materials (such as ground-glass joints, or, God forbid,  metal syringes).  If dispensing with a pipet, it’s crucial to flame-polish the edges for safety. Work behind a blast shield.

This article has useful tips on safe handling of diazomethane.

Furthermore, diazomethane is acutely toxic: people have died from inhaling it. And if it doesn’t kill you in the short term, there’s always the long term. See, diazomethane, being an alkylating agent, has a tendency to react with (i.e. alkylate) your DNA, leading to base-pair mismatches, mutations, and – eventually – cancer.

Check out the amount of red ink  on this preparation from Organic Syntheses. That should tell you a lot.

Note 4: Why bother using diazomethane at all?  Because it’s the best. The formation of methyl esters from the reaction of carboxylic acids with diazomethane is one of my favorite reactions. You make a solution of your carboxylic acid in ether,  dispense the bright yellow diazomethane solution by pipet – slowly – until the yellow color persists, wait about 5 minutes to be sure that all the N2 has bubbled off, kill the excess diazomethane with a few drops of acetic acid, and concentrate. No column required. Easiest reaction ever.

Note 5. What about using, say, diazoethane to make ethyl esters, or diazopropane to make propyl esters? It can be done – see here – the problem is getting a good yield of the diazoalkanes (30% is typical for older procedures). One more recent paper has better yields. (See reference 10)

Note 6. The reaction works better with more acidic alcohols like phenols (pKa 10). The reaction can be made to work with alkyl alcohols if a Lewis acid like BF3 is added.

Solution of diazomethane behind a blast shield – credit Christian Rosales, Carleton University

Quiz Yourself!

Click to Flip

Click to Flip

(Advanced) References and Further Reading

For some riveting, mouth-agape horror stories of diazomethane in the lab, check out this thread from In the Pipeline : Diazomethane: How Not To Do It.

Diazomethane is a reagent commonly used in organic chemistry for a variety of transformations. It is too reactive to be sold as a pure compound; it is generated from precursors in solution and used immediately.

  1. Ueber Diazomethan
    V. Pechmann
    Chem. Ber. 1894, 27 (2), 1888-1891
  2. Ueber Diazomethan
    v. Pechmann
    Chem. Ber. 1895, 28 (1), 855-861
    The first two papers by Hans von Pechmann on the synthesis and discovery of diazomethane.
    J. de Boer and H. J. Backer
    Org. Synth. 1956, 36, 16
    This procedure, the base-catalyzed decomposition of p-tolylsulfonylmethylnitrosamide, is the most common method for preparing diazomethane today. The diazomethane is generated as an ethereal solution and should be used quickly. Aldrich sells kits for the preparation of diazomethane based on this, and the precursor is commercially available and is commonly called ‘DIAZALD®’.
  4. Improved Arndt−Eistert Synthesis of α-Diazoketones Requiring Minimal Diazomethane in the Presence of Calcium Oxide as Acid Scavenger
    Vittorio Pace, Guido Verniest, Josep-Vicent Sinisterra, Andrés R. Alcántara, and Norbert De Kimpe
    The Journal of Organic Chemistry 2010 75 (16), 5760-5763
    DOI: 10.1021/jo101105g
    This 2010 procedure uses calcium oxide as a base to scavenge HCl during the formation of diazoketones.
    G. Gassman and W. J. Greenlee
    Org. Synth. 1973, 53, 38
    Note 1 in this procedure has detailed notes on safety regarding the use of diazomethane. Teflon stirbars should be used, metal should be avoided, the solution kept away from light, and glassware with ground-glass joints should not be used.
  6. Iron-Catalyzed Cyclopropanation in 6 M KOH with in Situ Generation of Diazomethane
    Bill Morandi and Erick M. Carreira
    Science 23 Mar 2012: Vol. 335, Issue 6075, pp. 1471-1474
    This paper describes a ‘one-pot’ cyclopropanation of styrenes and related compounds without the prior isolation of diazomethane, thereby making this chemistry safer and more practical.
  7. Trimethylsilyl-substituted diazoalkanes : I. Trimethylsilyldiazomethane
    Dietmar Seyferth, Horst Menzel, Alan W. Dow, Thomas C. Flood
    Journal of Organometallic Chemistry 1972, 44 (2), 279-290
    Trimethylsilyldiazomethane (aka ‘TMS-diazomethane’) is a much easier to handle alternative to diazomethane. It is commercially available and can be used for much of the same reactions that diazomethane undergoes.
  8. Rapid and convenient isolation and methyl esterification of water-soluble acids using diazomethane
    J. Eisenbraun, R. N. Morris, and G. Adolphen
    Journal of Chemical Education 1970, 47 (10), 710
    This is a short note that describes a modification to the usual esterification procedure with diazomethane to facilitate the esterification of water-soluble carboxylic acids.
  9. Mechanism of Methyl Esterification of Carboxylic Acids by Trimethylsilyldiazomethane
    Erik Kühnel, David D. P. Laffan, Guy C. Lloyd‐Jones, Teresa Martínez del Campo, Ian R. Shepperson, Jennifer L. Slaughter
    Angew. Chem. Int. Ed. 2007, 46 (37), 7075-7078
    DOI: 10.1002/anie.200702131
    The esterification of carboxylic acids is a common reaction of diazoalkanes, especially diazomethane. TMS-diazomethane can also be used for this reaction as a safer alternative to diazomethane
  10. Catalytic Homologation of Cycloalkanones with Substituted Diazomethanes. Mild and Efficient Single-Step Access to α-Tertiary and α-Quaternary Carbonyl Compounds
    David C. Moebius and Jason S. Kingsbury
    Journal of the American Chemical Society 2009 131 (3), 878-879

    DOI: 10.1021/ja809220j
    This paper contains procedures for making a large variety of substituted diazomethane derivatives. It also has extremely useful notes on safe handling and preparation of diazomethane and its derivatives.


Comment section

26 thoughts on “Diazomethane (CH2N2)

  1. But diazomethane gives methyl ethers too in presence of hbf4 or bf3 can you share its mechanism as in what special does hbf4 or bf3 does such that reaction proceeds

    1. Right. So the problem with doing it with normal alcohols is that alcohols are not acidic enough to protonate the CH2 on diazomethane. The solution is to use a protic acid like HBF4 as you mentioned. This gives CH3-N2(+) which is an excellent alkylating agent.

    1. Under normal conditions, no reaction, but if the CH2N2 is agitated photochemically there could be formation of carbene and C-H insertion to either C-1 or C-2 of propane. Not something I would recommend.

  2. In the late 1980s in the all the way into the mid- 1990s, as an Sr Laboratory Tech I set up the organic synthesis using Diazald® kit through Aldrich .

    I perform 200 to 300 herbicide analyses per year through MTH 8150 SW 846. 3 version and I extracted my own samples.

    I was well trained and well-versed in the safety hazards to being very cautious, and handling during the organic synthesis.

    No ground glass joints!!. Ice down bath in the receiving flask. The reactions took place under a fume Hood and behind safety tempered blast shield.

    Everything was smooth glass joints, triple rinse with petroleum ether production of least 100 to 200 milliliters of diazomethane at the end the synthesis was placed put into 4 or 5 40 mil Amber – Brown Teflon sealed capped then stored at 4 degrees Celsius in the laboratory refrigerator. Until was needed for reagent during the second part of the extraction process of MTH 8150.

    After the rigorous extraction of at least 10 to 15 samples per day which took two days. Or 2/8 hour shift work., after the extraction of samples with diethyl ether was almost complete post Nordstrom blowdown throughs volume Zymark turbovap nitrogen blowdown. I would use the diazomethane 1 mil into each vial let it react for at least 2 to 3 minutes until bubbling stopped or I add silicic acid to stop the reaction. Transferred to GC vial be via pipette, capped, transferred to the GC /MS . For years, I never gave any thought about being injured on the job.

    1. Great question Eric. It depends on scale. For large scale reactions (say a gram or more) the Fischer is probably your best bet for reasons of cost and safety. It’s “set and forget”, come back in a few hours or the next morning and it will be done.
      However a lot of exploratory organic chemistry is done on 50-100 mg of material (or less!) and in these cases, setting up a Fischer with a Dean-Stark trap isn’t very effective. Having a reagent available such as diazomethane that can quickly and easily (20 minutes !) install a methyl ester on a carboxylic acid is a huge time saver.

  3. Thank you for creating not only the best organic chemistry website but really the only website that is of any help. I am taking organic chemistry II right now and this site is a lifesaver! It is a better resource than my textbook by far, from the amount of information to the way you explain everything. Just wanted to let you know I really appreciate your work!

  4. If we add this compound (diazomethane) to cyclopentanal, will we get cyclohexanal. If yes, is this type of reaction called kohler synthesis?

  5. The new multiple-pesticide residue methods (MRM) were designated as NIOSH 5605 and 9204. They have not been published yet. In fact NIOSH hasn’t even reviewed them yet.(they had some cutbacks just after we finished the methods). We are in contact with them and sometime this month or next they want to talk to us about getting the final versions of the methods. So far 5602 and 9201 are the only methods we did that use diazomethane that have been published (can find them by searching “NIOSH 5602” or 9201 on line). Those published methods do not discuss the effects of diazomethane that we will report in 5605 and 9204. At this point the latter two methods are still NIOSH property and we are scheduled to work with NIOSH contacts later this month or next to get these method to them for final review. (It takes forever.)

    These later NIOSH methods do not in themselves delve into the mechanism, it just reports the phenomenon as a caution to those using diazomethane in a MRM involving both acids and neutrals.
    John M. Reynolds

  6. James,
    Loved your expose’. I have been using diazomethane for…I think 30-40 years (I’m 75, and still in one piece). Use it for pesticide analysis by GC-MS. Love it because it methylates sterically hindered benzoic acids, and phenols at the same time, AND does not affect my non-acid pesticides…so I can analyze them all together at once, when I want to. Discovered and reported that in NIOSH methods NMAM 9201 and 5602. In a method now being written up for NIOSH I evaluated the effects of diazomethane on dozens more of non-acid pesticides. It methylates imides (with an ionizable proton, e.g., acephate), and some keto-enol types (e.g., warfarin). It causes alpha-cyano pyrethroids to racemize around the benzylic carbon. Haven’t figured that one out. These effects are being reported in upcoming NIOSH methods. Couldn’t get it to methylate thio-acids. Have to resort to iodomethane.
    John M. Reynolds

    1. Fantastic comment. Very interesting. CH2N2 formation of methyl esters is definitely my favorite reaction to run: add, wait for bubbling to stop, then concentrate. Could you share a link to your methods?

  7. Hi!
    I have just find this website some minutes ago. I am a girl from Hungary, and last week I made an experiment with diazomethane, but I do not know, what happened, and I am really curious about your opinion.
    So I wanted to make methyl chloroacetate, that’s why I solve 1 g chloroacetic acid in 10 ml THF and add diazomethane to that compound. I was waiting for 30 minutes and add 0,5 ml water. Then I evaporate the THF, and what I got was – in the beginning yellow, then really RED thing. I found it very strange, because I had thought the esther will be clear. My teacher check it in MS, and we did not have the molar mass of methyl chloroacetate in the chromatogram. Do you have any idea what happens? I am really excited!
    Thank you very much in advance,

  8. Thank you very much for this invaluable support. Many android users we would also love to have thiss type of support on our cell phones, do you plan to relase the app also for android?. Thanks again!

  9. I’ve been thinking about this for the past couple of days and did some reading up on diazomethane, but still haven’t been able to figure out why it has a tendency to explode when in the presence of high-surface-area materials or sharp edges. Does it have to do with the increased friction associated w/ high-surface areas and sharp edges?

    1. I’m not 100% certain on this, but here’s my best guess. The surface of glass can be mildly acidic due to Si-OH groups. On a surface with enough hydrogen bond donors present you might be able to protonate/stabilize the CH2 and/or displace N2, and the exotherm in doing so may catalyze further reaction.

  10. Ah yes, diazomethane. I had a friend in grad school, now graduated, who had to work with it once. He was legendary for his operational prowess in the lab—and diazomethane scared the pants off of him!

    Notably, diazomethane is also probably the smallest ylide. I like to think of ylides as both nucleophilic and electrophilic at C—that’s why cyclopropanation works, because alkenes are both nucleophilic and electrophilic too (albeit on different atoms). Diazomethane, Simmons-Smith, Corey-Chaykovsky, and even rhodium carbenoids all operate on this principle.

    1. I never thought of it as an ylide! but it makes perfect sense.

      I was more scared by the making of it than actually using it, but it was definitely a two-hands-on-the-flask kind of reagent when you transfer it from the fridge to the hood.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.