The determination of extremely small quantities of DNA from complex biological sample matrices represents a significant bottleneck in nucleic acid analysis. In this study, polymeric ionic liquid (PIL)-based solid-phase microextraction (SPME) was applied for the extraction and purification of DNA from crude bacterial cell lysate with subsequent quantification by real-time PCR (qPCR) analysis. Using an on-fiber ultraviolet initiated polymerization technique, eight different PIL sorbent coatings were generated and their DNA extraction performance evaluated using qPCR. The PIL sorbent coating featuring halide anions and carboxylic acid groups in the cationic portion exhibited superior DNA extraction capabilities when compared to the other studied PILs and a commercial polyacrylate SPME fiber. Electrostatic interactions as well as an ion-exchange mechanism were identified as the driving forces in DNA extraction by the PIL sorbents. The selectivity of the PIL sorbent coating for DNA was demonstrated in the presence of PCR inhibitors at high concentration, where a quantifiable amount of template DNA was extracted from aqueous samples containing CaCl2 and FeCl3. Furthermore, the PIL-based SPME method was successfully applied for the extraction of DNA from crude bacterial cell lysate spiked with 1 pg mL-1 template DNA without requiring the use of organic solvents or centrifugation steps. Following PIL-based SPME of DNA from a dilute cell lysate, the qPCR amplification efficiency was determined to be 100.3%, demonstrating the feasibility of the developed method to extract high purity DNA from complex sample matrices.