With the improvement of our national living standard, consumers have higher requirements for the quality of eggs. The detection of cracked eggs is an important step before packing eggs. In order to solve the problems of high labor intensity and heavy workload in manual sorting of cracked eggs, a cracked egg sorting robot based on machine vision and YOLO v5 was designed. Firstly, the rotation Angle of each steering gear of the manipulator was obtained by inverse kinematics and converted into PWM duty cycle to realize the control of the three-axis series manipulator. Secondly, a high-definition 120° wide-angle camera was used as the image acquisition core to quickly acquire the image information of egg surface and label the 1 000 images collected. YOLO v5 models with different gradient descent batch sizes were then trained respectively,among which the model with gradient descent batch size of 8 had the highest mAP with a value of 98.92%. Finally, the model was called on the main board of the upper computer of the mechanical arm, and after the recognition and judgment of normal eggs and cracked eggs, the sorting stroke of the mechanical arm was started. In addition, the end pickup mechanism of the egg sorting robot was a pneumatic suction cup, which was mounted on the mechanical arm to achieve non-destructive absorption of eggs. The test results showed that the robot can identify the two kinds of eggs with the accuracy of 93.33% and 99.17% respectively, the average success rate of sorting is 94.34%, and the average sorting rate was 7.55 s/egg, which basically met the requirements. The research results can provide technical support for the screening of cracked eggs, and provide solutions for crack detection and sorting of eggs, which has high practical significance.