Near-infrared sensors can be calibrated for fast online quality control measurements of the composition of pharmaceuticals. Near-infrared analysis enables the determination of the amounts of active pharmaceutical ingredient (API) and excipients in pharmaceutical drugs, quality control for the ingredients before, during and after the manufacturing process, determination of tablet coating thickness, and quantification of moisture content.