Pharmaceutical compounding (done in compounding pharmacies) is the creation of a particular pharmaceutical product to fit the unique need of a patient. To do this, compounding pharmacists combine or process appropriate ingredients using various tools. This may be done for medically necessary reasons, such as to change the form of the medication from a solid pill to a liquid, to avoid a non-essential ingredient that the patient is allergic to, or to obtain the exact dose(s) needed or deemed best of particular active pharmaceutical ingredient(s). It may also be done for more optional reasons, such as adding flavors to a medication or otherwise altering taste or texture. Compounding is most routine in the case of intravenous/parenteral medication, typically by hospital pharmacists, but is also offered by privately owned compounding pharmacies and certain retail pharmacies for various forms of medication. Whether routine or rare, intravenous or oral, etc., when a given drug product is made or modified to have characteristics that are specifically prescribed for an individual patient, it is known as "traditional" compounding.
Due to the rising cost of compounding and the shortage of drugs, many hospitals have shown a tendency to rely more upon large-scale compounding pharmacies to meet their regular requirement, particularly of sterile-injectable medications. When compounding is done on bulk production of a given formulation rather than patient-specific production, it is known as "non-traditional" compounding (which, as discussed below, is arguably not "compounding" but rather "manufacturing"). This development raises concerns about patient safety and makes a case for proper regulatory control and monitoring.
Before mass production of medications became widespread, compounding was a routine activity among pharmacists. Community pharmacists who have experience with compounding techniques are now less common.
Pharmaceutical compounding has ancient roots. Hunter-gatherer societies had some knowledge of the medicinal properties of the animals, plants, molds, fungus and bacteria as well as inorganic minerals within their environment. Ancient civilizations used pharmaceutical compounding for religion, grooming, keeping the healthy well, treating the ill and preparing the dead. These ancient compounders produced the first oils from plants and animals. They discovered poisons and the antidotes. They made ointments for wounded patients and perfumes for customers.
The earliest chemists were familiar with various natural substances and their uses. These drug artisans compounded a variety of preparations such as medications, dyes, incense, perfumes, ceremonial compounds, preservatives and cosmetics. Drug compounders seeking gold and the fountain of youth drove the alchemy movement. Alchemy eventually contributed to the creation of modern pharmacy and the principles of pharmacy compounding. In the medieval Islamic world in particular, Muslim pharmacists and chemists developed advanced methods of compounding drugs. The first drugstores were opened by Muslim pharmacists in Baghdad in 754.