Neem (Azadirachta indica) extract is well-known as a natural pesticide for the control of agricultural pests. Azadirachtin A and its structural analogues are considered as active compounds. However, the amounts of azadirachtins varies in neem extracts, providing a variety of insecticidal activities. In this study, a novel method of automated online solid-phase extraction coupled with liquid chromatography/quadrupole-time-of-flight mass spectrometry (SPE-LC–Q-TOF–MS) was developed and validated for simultaneous quantification of five azadirachtins (azadirachtins A, B, D, H and I) in seed and leaf extracts of A. indica. Different experimental parameters (such as SPE cartridge, injection volume and washing step) were optimized. The optimized SPE-LC–Q-TOF–MS method showed good recovery (82.0–102.8%), linearity (r2 ≥ 0.9991) and precision (0.83–4.83%). The limit of detections (LODs) for the five analytes ranged from 0.34 to 0.76 ng mL−1. The validated method was successfully applied for determination of the analytes in the neem leaves and seeds from different locations and a neem formulation. The online SPE-LC–Q-TOF–MS method was found to be a simple, precise and accurate and can be used as a powerful tool for quality control of neem extracts or its formulations.Electronic supplementary materialThe online version of this article (10.1186/s13065-018-0453-y) contains supplementary material, which is available to authorized users.