The magnetic force of permanent magnet can stay for a long time but it is not really permanent. There are 8 factors which will affect magnetic force.
1.The material formulation: Material formulation limits magnetic properties fundamentally. Sintered ndfeb magnet is the strongest and alnico is the weakest. There is also difference for the same material based on formulation. The magnetic force for grade N45 is higher than grade N35 for the same size magnet.
2.Magnet size and shape
3.The magnetization saturability: Only when full charged, magnetic force can be achieved completely.
4.Design of magnetic circuit: Different magnetized direction, the magnetic force is different. For a cylinder magnet, magnetic force by axial-magnetized is stronger than diameter-magnetized.
5.Working temperature: Magnet is very sensitive to working temperature, especially for sintered ndfeb magnet. The momentary and continuous highest temperature of environment may cause certain demagnetization including recoverable and unrecoverable, reversible and irreversible. According to working temperature range 80-200 celsius, sintered ndfeb magnet is divided into several grade series (N, M, H, SH, UH, AH etc.). The cost will be expensive for high working temperature grade. So you need to consider your working temperature and choose the right grade. The loss of magnetic force can be ignored under working temperature permitted range. But magnetic force will decrease rapidly while working under a limit working temperature for a long time.
6.Working humidity: Sintered ndfeb magnet is easy to be oxidized and then loss its magnetic force. We use coating to avoid this problem. But this is not a permanent solution. So the dryer, the better.
7.External magnetic field: Magnetic force will reduce while placing opposite poles around magnet, only when the magnetic field of opposite poles is several times larger than magnet itself, the reduction will be evident.
8.Strong shock: It will reduce magnetic force, but needs long time.