Caffeine is a xanthine alkaloid found in non-alcoholic beverages such as tea, coffee, and cocoa. It was discovered in tea and coffee in the 1820s, but it was not until 2000 that details of molecular events associated with caffeine biosynthesis began to be unraveled. Reviewed are the occurrence of xanthine alkaloids in the plant kingdom and the elucidation of the caffeine biosynthesis pathway, providing details of the N-methyltransferases, belonging to the motif B' methyltransferase family, which catalyze three steps in the four-step pathway leading from xanthosine to caffeine. Pathways for the metabolism and degradation of xanthine alkaloids are discussed, although as yet the genes and enzymes involved have not been isolated. This chapter also considers the in planta role of caffeine in chemical defense that has been demonstrated using transgenic caffeine-forming tobacco and chrysanthemum plants, which are resistant to attack by pathogens and herbivores. Finally, future research is considered that might lead to the production of naturally decaffeinated beverages and agricultural crops that contain elevated levels of "natural" pesticides.