A grass trimmer includes a trimming head, a driving device for driving the trimming head to rotate so as to cut vegetation and an operating device for a user to operate so as to control the driving device. The trimming head includes a spool and a line holding element, the spool is used to wind a trimming line, and the line holding element is formed with a line holding structure. The driving device includes a motor. The grass trimmer has an auto-winding mode. In the auto-winding mode, the motor drives at least one of the spool and the line holding element to make the spool and the line holding element rotate relatively so that the trimming line is wound on the spool automatically.