Alkaloids are a group of naturally occurring chemical compounds, that contain mostly basic nitrogen atoms. This group also includes some related compounds with neutral and even weakly acidic properties. Some synthetic compounds of similar structure are also attributed to alkaloids. In addition to carbon, hydrogen and nitrogen, alkaloids may also contain oxygen, sulfur and more rarely other elements such as chlorine, bromine, and phosphorus.
Alkaloids are produced by a large variety of organisms, including bacteria, fungi, plants, and animals, and are part of the group of natural products (also called secondary metabolites). Many alkaloids can be purified from crude extracts by acid-base extraction. Many alkaloids are toxic to other organisms. They often have pharmacological effects and are used as medications, as recreational drugs, or in entheogenic rituals. Examples are the local anesthetic and stimulant cocaine; the psychedelic psilocin; the stimulant caffeine; nicotine; the analgesic morphine; the antibacterial berberine; the anticancer compound vincristine; the antihypertension agent reserpine; the cholinomimeric galantamine; the spasmolysis agent atropine; the vasodilator vincamine; the anti-arhythmia compound quinidine; the anti-asthma therapeutic ephedrine; and the antimalarial drug quinine. Although alkaloids act on a diversity of metabolic systems in humans and other animals, they almost uniformly invoke a bitter taste.
The boundary between alkaloids and other nitrogen-containing natural compounds is not clear-cut. Compounds like amino acid peptides, proteins, nucleotides, nucleic acid, amines, and antibiotics are usually not called alkaloids. Natural compounds containing nitrogen in the exocyclic position (mescaline, serotonin, dopamine, etc.) are usually attributed to amines rather than alkaloids. Some authors, however, consider alkaloids a special case of amines.