We describe a numerical technique for calculating the 2D magnetic field in arbitrary magnetic susceptibility distribution. The technique we used is the explicit finite difference method with an addition of the Du Fort-Frankle algorithm. The proposed algorithm is unconditionally stable and has excellent convergence properties. For simple geometries, numerical results were compared against analytical solutions and appeared to be in excellent agreement.