Abstract A method for the immunoaffinity extraction of dexamethasone and betamethasone in bovine urine, followed by high-pressure liquid chromatography (HPLC) fractionation and gas chromatography–mass spectrometry determination, is described. A commercial immunoaffinity gel, containing antibodies raised against dexamethasone, was used to prepare an immunoaffinity cartridge which was inserted in an automatic HPLC system for on-line extraction and purification. By injecting urine samples (spiked with flumethasone as internal standard) directly into the system, it was possible to collect purified fractions, containing the analytes of interest. The fractions were dried and derivatized to yield the tetra-trimethylsilyl derivatives of the three corticosteroids, which were analyzed by selected ion monitoring gas chromatography–mass spectrometry. The method allowed a very good purification of samples and reached a detection limit of 0.1 ng/ml for dexamethasone and 0.2 ng/ml for betamethasone. Several samples, coming from a steer treated with dexamethasone and from other bovines coming from breedings in northern Italy, were analyzed with the method described. Dexamethasone levels ranged from 0.12 to 146 ng/ml.