Alkyltrimethylammonium compounds (ATMACs), dialkyldimethylammonium compounds (DADMACs) and benzylalkyldimethylethylammonium compounds (BACs) are quaternary alkylammonium compounds (QAAC), which are released into the environment in large quantities after their use in cleaning agents and disinfectants. Despite their potential role as selective agents promoting resistance against QAACs as well as antibiotics, there is a lack of data for QAACs in soil due to the lack of sensitive analytical methods. Therefore, we present a robust and fast method for the extraction and quantification of concentrations of these compounds in soil and sewage sludge. The method is based on ultrasonic extraction (USE) with a mixture of acetonitrile and HCl followed by a solid phase extraction (SPE) cleaning step and a subsequent quantification of concentrations with high performance liquid chromatography with mass spectrometry (HPLC-MS/MS) in multi mass reaction mode (MRM). The proposed method is suitable for the quantification of ATMACs (chain length C-8 to C-16), BACs (C-8 to C-18) and DADMACs (C-8 to C-16). The achieved limits of quantification (LOQ) range from 0.1 μg kg
-1
to 2.1 μg kg
-1
. The recovery rates of spiked soil samples for non-deuterated homologues were between 47% and 57%. The analysis of sewage sludge samples and soil samples revealed that BAC-C12 was the most abundant QAAC with concentrations up to 38600 μg kg
-1
in sewage sludge and up to 81 μg kg
-1
in a Mexican soil that was irrigated with wastewater. Overall, the presented methods open perspectives for effectively studying fate and effects of QAACs in soils.