In the present study, a derivatization method for the determination of acidic herbicides has been investigated. This procedure involves the methylation with the quaternary ammonium salt trimethylanilinium hydroxide (TMAH) directly in the gas chromatographic auto-sampler vial for analysis by gas chromatography combined with mass spectrometry. The derivatization reaction has been screened for influential factors and statistically significant parameters. The identified factors, reaction time, temperature and hold-up time were optimized by a complete factorial response surface design and optimal reaction conditions were generated. Finally, the optimized methylation procedure was compared to different alkylation methods and obtained results demonstrated the applicability of derivatization with trimethylanilinium hydroxide. Acidic herbicides used in the study consist of several families of compounds like derivatives of acetic acid (2,4-D and 2,4,5-T), butanoic acid (MCPB), benzoic acid (chloramben, dicamba), phenol (dinoseb and dinoterb), propanoic acid (mecoprop) and other miscellaneous acids such as pyridinecarboxlyic acid (picloram). A reliably working, rapid method for the preparation of methyl compounds is generated with respect to automation for routine analysis.