A solid-phase microextraction (SPME) method has been developed and optimized for the polar residual solvent determination in pharmaceutical products. Five different polymer-coated fibers were investigated and the Carboxen/polydimethylsiloxane was found to be the most sensitive for all components. Two Headspace SPME methods were developed and optimized: one for the extraction from aqueous solutions, and the other for the extraction from organic solutions (N,N-dimethyl formamide (DMF) and dimethyl sulfoxide (DMSO). The optimum equilibration time for all components and all systems was 30 min. It was found that the sample headspace volume has an important effect on method sensitivity and precision. At low headspace volumes (less than one-third of the vial volume), sensitivity improves but at the same time, precision worsens. For 10 ml headspace vials, the optimum headspace volume was found to be 3 ml. The total volatile organic content in the sample also has an important effect on method sensitivity and precision. At low organic content, sensitivity increases but precision drops significantly. Over 0.5% volatile organic content in the sample, the system becomes unstable due to stationary phase swelling by the organic components, and also the sensitivity of the method is drastically reduced. The optimum range for total volatile organic content was found to be between 0.01 and 0.1%. The added Na2SO4 quantity increases the extraction yield. It was found that slightly pressurizing the headspace vial improves the sensitivity of the method by a factor of 2. For the organic system, it was found that the addition of 100 microl DMSO or DMF to 50 mg drug substance and slightly pressurizing the headspace vial gives good results in terms of sensitivity and reproducibility. The measured detection limits were between 0.4 and 200 ng/ml, and the relative standard deviation data were between 2 and 9%. The Headspace SPME from aqueous solutions was found to be ten times more sensitive than Immersion SPME and Headspace SPME from organic solutions.