A novel online approach involving in-syringe magnetic stirring assisted dispersive liquid–liquid microextraction and derivatization coupled to gas chromatography–mass spectrometry has been developed for the determination of seven UV filters extensively used in cosmetic products in environmental water samples. The effect of parameters such as the type and volume of extraction solvent, dispersive solvent and derivatization agent, pH, ionic strength and stirring time, was studied using multivariate experimental design. Extraction, derivatization and preconcentration were simultaneously performed using acetone as dispersive solvent, N,O-bis(trimethylsilyl)trifluoroacetamide (BSTFA) as derivatization agent and trichloroethylene as extraction solvent. After stirring during 160s, the sedimented phase was transferred to a rotary micro-volume injection valve (3μL) and introduced by an air stream into the injector of the GC through a stainless-steel tube used as interface. The detection limits were in the range of 0.023–0.16μgL−1 and good linearity was observed up to 500μgL−1 of the studied UV filters, with R2 ranging between 0.9829 and 0.9963. The inter-day precision expressed as relative standard deviation (n=5) varied between 5.5 and 16.8%. Finally, the developed method was satisfactorily applied to assess the occurrence of the studied UV filters in seawater and pool water samples. Some of the studied UV filters were found in these samples and an add-recovery test was also successfully performed with recoveries between 82 and 111%.