An electronic apparatus having a magnetic switch includes a first body, at least one magnetic component, a second body, and a magnetism barrier. In this case, the first body has at least one space. The magnetic component is accommodated in the space. The second body has at least one magnetizer, which is opposite to the magnetic component. The second body is pivoted on the first body. When the first body and the second body are closed, the magnetic component and the magnetizer face to each other. The magnetism barrier is disposed in the space of the first body. The magnetism barrier is disposed between the first body and the magnetic component.