Cyanides and isocyanides

Two molecules can be built from exactly the same three atoms — one carbon, one nitrogen, and a triple bond joining them — and still behave like near-strangers. Attach an alkyl group through the carbon end and you get a cyanide (nitrile): faintly sweet-smelling, chemically mild-mannered. Attach the very same alkyl group through the nitrogen end instead, and you get an isocyanide (carbylamine): one of the most stomach-turning odours in organic chemistry, made in a completely different way. This section is about that single reversal of connectivity, R-C≡NR\text{-}C\equiv N versus R-N≡CR\text{-}N\equiv C, and why it forces chemists to reach for two different reagents — ionic KCNKCN for one, covalent AgCNAgCN for the other — to make what looks, on paper, like almost the same thing. Once the C-versus-N attachment is fixed in your head, every preparation, name, and exam trap in this topic follows from it almost automatically.

The core insight

Cyanides (R-CNR\text{-}CN, C-bonded) and isocyanides (R-NCR\text{-}NC, N-bonded) are isomers of the same −C≡N-C\equiv N unit, and the ionic-versus-covalent character of the cyanide reagent used decides which end attacks an alkyl halide first.

The core idea

Two isomers, one functional group, opposite attachment. A cyanide (also called a nitrile or alkyl cyanide) is R-C≡NR\text{-}C\equiv N: the carbon atom of the −CN-CN group is the one bonded to the rest of the molecule. An isocyanide (also called a carbylamine or isonitrile) is the mirror image in connectivity, R-N≡CR\text{-}N\equiv C: nitrogen is the bonded atom, and the terminal carbon carries a lone pair in the best resonance structure, R-=C:R\text{-}\overset{-}{N}=C:. IUPAC names cyanides as alkanenitriles (ethyl cyanide is propanenitrile); isocyanides are simply named as alkyl isocyanides or alkyl carbylamines — there is no separate IUPAC suffix system for them at this level. Both groups carry the same total unsaturation, one triple-bond's worth of C–N multiple bonding, so nothing about bond order distinguishes them; only the point of attachment does, and that one fact governs everything downstream — preparation, smell, and reactivity.

Cyanides are made two ways. From an alkyl halide, heating with alcoholic KCNKCN (or NaCNNaCN) substitutes the halide by the cyanide ion, which is free and ionic and attacks predominantly through its carbon:

R-X+KCN→alcoholR-CN+KXR\text{-}X + KCN \xrightarrow{\text{alcohol}} R\text{-}CN + KX

where: R-XR\text{-}X is the alkyl halide, KCNKCN supplies a free, ionic cyanide ion, and R-CNR\text{-}CN is the alkyl cyanide (nitrile) product with KXKX as the by-product salt. From an amide, dehydration with phosphorus pentoxide on heating removes a water molecule and leaves the nitrile behind, with no change in carbon count:

R-CONH2→P2O5, ΔR-CN+H2OR\text{-}CONH_2 \xrightarrow{P_2O_5,\ \Delta} R\text{-}CN + H_2O

where: R-CONH2R\text{-}CONH_2 is a primary amide, P2O5P_2O_5 is the dehydrating agent, Δ\Delta denotes heating, and the nitrile product retains the same carbon skeleton as the amide it came from.

Isocyanides are also made two ways, but with different reagents. From an alkyl halide, heating with alcoholic silver cyanide, AgCNAgCN — a covalent compound, with the metal bonded through carbon — leaves the nitrogen end free to act as the attacking nucleophile:

R-X+AgCN→alcoholR-NC+AgXR\text{-}X + AgCN \xrightarrow{\text{alcohol}} R\text{-}NC + AgX

From a primary amine, the carbylamine reaction — heating with chloroform and alcoholic KOHKOH — builds the isocyanide directly and is also the standard qualitative test for a 1° amine, since only primary amines give this foul-smelling product:

R-NH2+CHCl3+3KOH→ΔR-NC+3KCl+3H2OR\text{-}NH_2 + CHCl_3 + 3KOH \xrightarrow{\Delta} R\text{-}NC + 3KCl + 3H_2O

where: R-NH2R\text{-}NH_2 must be a primary amine (secondary and tertiary amines give no reaction here), CHCl3CHCl_3 is chloroform, and alcoholic KOHKOH supplies the base that generates the reactive dichlorocarbene intermediate driving the reaction (mechanism beyond syllabus scope; only the net equation is required). The figure below fixes the contrast that the whole topic hinges on.

Figure
Two boxes comparing cyanide and isocyanide showing the carbon or nitrogen attachment point and the reagent that forms each from an alkyl halide
Same R and same C-N unit, opposite point of attachment Cyanide (nitrile) R — C ≡ N carbon bonded to R from R-X + KCN (ionic) or amide + P2O5 faint, mild smell Isocyanide (carbylamine) R — N ≡ C nitrogen bonded to R from R-X + AgCN (covalent) or amine + CHCl3 + KOH extremely foul smell The reagent character (ionic KCN versus covalent AgCN) decides which atom attacks first

Why it works

This topic is purely descriptive at ISC level — a naming and preparation contrast, not a numerical formula — so the reasoning that matters is why the same cyanide ion gives two different products depending on the metal it is paired with, rather than any calculation. Cyanide, CN−CN^-, is an ambident nucleophile: it has two atoms, carbon and nitrogen, either of which could in principle attack an electrophilic carbon in a substitution reaction. Which one actually attacks depends on how "free" that ion is. In KCNKCN, the bond between potassium and the cyanide group is essentially ionic — K+K^+ and CN−CN^- exist as separate, freely moving ions in solution. A free cyanide ion is a hard, small, negatively charged species, and in this dissociated state the carbon end is the softer, more polarisable, and kinetically more nucleophilic site, so it is carbon that bonds to the alkyl group, giving R-CNR\text{-}CN. In AgCNAgCN, by contrast, the silver–cyanide bond is substantially covalent: silver is bonded directly to the carbon atom of the cyanide group, Ag-C≡NAg\text{-}C\equiv N. That covalent Ag–C linkage ties up carbon and leaves the nitrogen lone pair as the only nucleophilic site available. So when an alkyl halide approaches AgCNAgCN, it is nitrogen — not carbon — that displaces the halide, giving R-NCR\text{-}NC. The identical starting alkyl halide, treated with two different-looking salts of the same CN−CN^- group, therefore lands on opposite products purely because of how ionic or covalent the metal–cyanide bond is. This ionic-versus-covalent contrast is the single reasoning thread the ISC syllabus expects a student to reproduce, and it is also why the two families differ so sharply in smell: the isocyanide's terminal carbon, carrying a lone pair rather than being fully bonded, is the reactive, foul-smelling centre that the carbylamine test exploits.

Worked example

Problem. Ethyl bromide, CH3CH2BrCH_3CH_2Br, is treated separately with (a) alcoholic KCNKCN and (b) alcoholic AgCNAgCN. Identify the product formed in each case, and explain briefly why the two differ.

Step 1. Reaction (a): CH3CH2Br+KCN→alcoholCH3CH2CN+KBrCH_3CH_2Br + KCN \xrightarrow{\text{alcohol}} CH_3CH_2CN + KBr. Because KCNKCN dissociates into free K+K^+ and CN−CN^- ions in alcohol, the ambident cyanide ion attacks through its softer, more nucleophilic carbon end. The product is ethyl cyanide, systematically named propanenitrile.

Step 2. Reaction (b): CH3CH2Br+AgCN→alcoholCH3CH2NC+AgBrCH_3CH_2Br + AgCN \xrightarrow{\text{alcohol}} CH_3CH_2NC + AgBr. Here AgCNAgCN is largely covalent, with silver bonded to carbon; this blocks the carbon end, so the free nitrogen lone pair performs the substitution instead. The product is ethyl isocyanide.

Step 3. Compare. Both reactions start from the identical alkyl halide and the identical CN−CN^- unit, yet give structurally different products — one C-bonded, one N-bonded — solely because of the ionic character of KCNKCN versus the covalent character of AgCNAgCN. Answer: (a) gives CH3CH2CNCH_3CH_2CN (ethyl cyanide/propanenitrile); (b) gives CH3CH2NCCH_3CH_2NC (ethyl isocyanide), because ionic KCNKCN favours C-attack while covalent AgCNAgCN forces N-attack.

Competitive stretch

Problem. Propanamide is heated with P2O5P_2O_5; separately, methanamine is heated with CHCl3CHCl_3 and alcoholic KOHKOH. Give both products and state which reaction is a diagnostic test.

Step 1. Dehydration: CH3CH2CONH2→P2O5, ΔCH3CH2CN+H2OCH_3CH_2CONH_2 \xrightarrow{P_2O_5,\ \Delta} CH_3CH_2CN + H_2O, giving propanenitrile — same three carbons as the amide, one water molecule removed.

Step 2. Carbylamine reaction: CH3NH2+CHCl3+3KOH→ΔCH3NC+3KCl+3H2OCH_3NH_2 + CHCl_3 + 3KOH \xrightarrow{\Delta} CH_3NC + 3KCl + 3H_2O, giving methyl isocyanide, identified by its intensely unpleasant odour. Answer: propanenitrile from the amide; methyl isocyanide (with its telltale foul smell) from the amine — the second reaction is the carbylamine test for a primary amine.

Common traps

  • Assuming KCNKCN and AgCNAgCN give the same product with an alkyl halide — they give opposite regiochemical outcomes (C-attack vs N-attack) purely from ionic-versus-covalent character.
  • Confusing amide dehydration to a nitrile (loses H2OH_2O, same carbon count, needs P2O5P_2O_5) with Hofmann's degradation of an amide to an amine (loses one carbon as CO2CO_2, needs Br2/NaOHBr_2/NaOH) — different reactions on the same starting material.
  • Forgetting the carbylamine reaction works only on primary amines; secondary and tertiary amines give no isocyanide.
  • Drawing the isocyanide with carbon bonded to the alkyl group, as though it were a nitrile — the defining feature of an isocyanide is nitrogen bonded to R: R-NCR\text{-}NC, not R-CNR\text{-}CN.

Ask the tutor: want a quick side-by-side comparison table of cyanide versus isocyanide, or a few more practice equations contrasting KCN and AgCN with different alkyl halides?

Why does KCN attack through carbon but AgCN attack through nitrogen if the cyanide ion is the same in both?

The cyanide group is the same atoms in both cases, but how "free" it is differs. In KCNKCN the potassium-cyanide bond is essentially ionic, so CN−CN^- exists as a separate, mobile ion whose softer, more polarisable carbon end reacts fastest. In AgCNAgCN the silver is covalently bonded to the carbon atom itself, so that end is already tied up, forcing the nitrogen lone pair to be the nucleophile instead. It is the character of the metal-cyanide bond, not the cyanide ion itself, that flips the outcome.

Can a secondary amine undergo the carbylamine reaction?

No. The carbylamine (isocyanide) test with chloroform and alcoholic KOHKOH works only on primary amines, R-NH2R\text{-}NH_2. Secondary amines (R2NHR_2NH) and tertiary amines (R3NR_3N) do not have the free N-H2N\text{-}H_2 needed for the mechanism and give no foul-smelling isocyanide product. This selectivity is exactly why the reaction is used as a diagnostic test — a positive smell confirms a primary amine and rules out secondary or tertiary ones.

Is there any structural difference in bond order between a cyanide and an isocyanide?

Not really — both contain the same amount of carbon-nitrogen multiple bonding, roughly a triple bond (with the isocyanide better described by a resonance structure carrying a lone pair on the terminal carbon). The distinguishing feature is purely which atom, carbon or nitrogen, is bonded to the rest of the molecule. That single difference in connectivity is enough to change the name, the smell, and the preparation route completely, even though the molecular formula pattern looks almost identical on paper.

Before this

Where this leads