Low germination rates of damaged and moldy cottonseeds can significantly impact cotton yield. It is essential to select and remove such cottonseeds before sowing. This paper presents the design of an online single cottonseed sorting device to identify intact cottonseeds. The device comprises a blanking section and a sorting section. The blanking section utilizes a stepper motor and a turntable baffle to facilitate single seed blanking. The sorting section employs two cameras to capture images of falling cottonseeds, and a push–pull electromagnet is controlled by an upper computer signal to sort the cottonseeds. In the experiment, 420 images of intact, damaged, and moldy cottonseeds were collected and had their backgrounds removed. The sample was expanded to 5040 images through rotation and color enhancement. The YOLOv5 model was used to train cottonseed images, yielding a discrimination accuracy of 99.7 % for intact cottonseeds, 99.5 % for damaged cottonseeds, and 99.6 % for moldy cottonseeds. The overall accuracy reached 99.6 %. The device designed in this paper has a sorting rate of 300 grains per minute and exhibits high discrimination accuracy. The results demonstrate the positive value of this design for the development of seed sorting devices.