Due to the large number of ionic liquids (ILs) and their potential environmental risk, assessing the toxicity of ILs by ecotoxicological experiment only is insufficient. Quantitative structure- activity relationship (QSAR) has been proven to be a quick and effective method to estimate the viscosity, melting points, and even toxicity of ILs. In this work, the LC50 values of 30 imidazolium-based ILs were determined with Caenorhabditis elegans as a model animal. Four suitable molecular descriptors were selected on the basis of genetic function approximation algorithm to construct a QSAR model with an R^2 value of 0.938. The predicted lgLC50 in this work are in agreement with the experimental values, indicating that the model has good stability and predictive ability. Our study provides a valuable model to predict the potential toxicity of ILs with different sub-structures to the environment and human health.