The invention relates to a coded helmet lock, including a lock, a lock machine, a release button, a half-moon card, a small coded gear, a large coded gear, a lock shaft, a lock cover, a large coded wheel, a small coded wheel, a lock shaft cover, a coded wheel cover, The handlebar buckle and the handlebar buckle bolt; the lock bolt passes through the lock retainer, the first lock washer, the lock buckle, the second lock washer and the connection hole of the lock in turn and fixes it; the button seat and the release button pass through the button Shaft connection, a key spring is set between the key base and the release key, and the key base and the side of the release key are connected to the locking teeth. The locking teeth, the release key, the key shaft, the key base and the key spring form the release key assembly and are loaded into the In the button groove of the lock machine; the half-moon card shaft is connected with the shaft hole of the half-moon card, and the half-moon card is connected to the half-moon card spring. The beneficial effects of the present invention are: the present invention can provide a convenient and reliable helmet locking device for electric bicycle users, and solve the problem that the helmet may be stolen when going out.