Methylation is any chemical reaction that adds a methyl group (−CH3) to a chemical compound. It is a type of addition reaction. Methylation reactions take place between a methylating agent, the source of the methyl group, and a substrate that the methyl group is added to.
When the methylating agent is an electrophile, the methylation reaction normally uses the SN2 mechanism. The better the leaving group on the methylating agent, the stronger it becomes: iodomethane is a much stronger methylating agent than chloromethane, because iodide is a better leaving group than chloride. Highly electrophilic methylating agents like methyl fluorosulfonate are highly toxic and have lead to deaths in industrial accidents.
Organometallic compounds like methyllithium and methylmagnesium chloride are examples of nucleophilic methylating agents. These compounds act as equivalents of the synthon CH−3. Carbonyl compounds are a common substrate for nucleophilic methylation reactions, with the Grignard reaction of methylmagnesium chloride being one example.