This paper describes an electrical circuit that can be used to automatically magnetize and ac-demagnetize moderately soft magnetic materials and with minor modifications could be used to demagnetize harder magnetic materials and magnetic geological samples. The circuit is straightforward to replicate, easy to use, and low in cost. Independent control of the demagnetizing current frequency, amplitude, and duration is available. The paper describes the circuit operation in detail and shows that it can demagnetize a link-shaped specimen of 430FR stainless steel with 100% efficiency. Measurements of the demagnetization efficiency of the specimen with different ac-demagnetization frequencies are interpreted using eddy-current theory. The experimental results agree closely with the theoretical predictions.