An anti-theft mechanism for electronic devices includes an upper protecting frame and a lower protecting frame. The upper and lower protecting frames of the embodiment provide protection for the 3C products, and the first and second assembling space of the upper and lower protecting frames provide adjustable dimensions to be suitable for different sizes of 3C products. The upper and lower protecting frames can further be provided with a locking mechanism to limit the movement of the positioning member after the upper and lower protecting frames being attached onto the 3C products, which prevents the upper and lower protecting frames from being removed easily. Furthermore, with the steel wire of the locking mechanism can be attached to a secured object to secure the upper and lower protecting frames.