Dimethyl sulfate  Dimethyl sulfate is a chemical compound with formula (CH3O)2SO2. As the diester of methanol and sulfuric acid, its formula is often written as (CH3)2SO4 or even Me2SO4, where CH3 or Me is methyl. Me2SO4 is mainly used as a methylating agent in organic synthesis. Me2SO4 is a colourless oily liquid with a slight onion-like odour (although smelling it would represent significant exposure). Like all strong alkylating agents, Me2SO4 is extremely toxic. Its use as a laboratory reagent has been superseded to some extent by methyl triflate, CF3SO3CH3, the methyl ester of trifluoromethanesulfonic acid. Dimethyl sulfate was discovered in the early 19th century in an impure form. P. Claesson later extensively studied its preparation. It was used in chemical warfare in WWI. Dimethyl sulfate can be synthesized in the laboratory by many different methods, the simplest being the esterification of sulfuric acid with methanol: Another possible synthesis involves distillation of methyl hydrogen sulfate: Methyl nitrite and methyl chlorosulfonate also result in dimethyl sulfate:  Me2SO4 has been produced commercially since the 1920s. A common process is the continuous reaction of dimethyl ether with sulfur trioxide. Dimethyl sulfate is best known as a reagent for the methylation of phenols, amines, and thiols. One methyl group is transferred more quickly than the second. Methyl transfer is assumed to occur via an SN2 reaction. Compared to other methylating agents, dimethyl sulfate is preferred by the industry because of its low cost and high reactivity. Most commonly Me2SO4 is employed to methylate phenols. Some simple alcohols are also suitably methylated, as illustrated by the conversion of "tert"-butanol to t-butyl methyl ether: Alkoxide salts are rapidly methylated:  The methylation of sugars is called Haworth methylation. Me2SO4 is used to prepare both quaternary ammonium salts or tertiary amines: Quaternized fatty ammonium compounds are used as a surfactant or fabric softeners. Methylation to create a tertiary amine is illustrated as:  Similar to the methylation of alcohols, mercaptide salts are easily methylated by Me2SO4: An example is: This method has been used to prepare thioesters:  Dimethyl sulfate (DMS) is used to determine the secondary structure of RNA.