This study aims to develop a method to optimize magnetic recording conditions by using computer simulation for a high-accuracy magnetic encoder. The simulation uses the finite element method and the medium magnetization model to derive the magnetization of a recording medium and to detect the magnetic signals by a sensor. The simulation method is validated by comparing the simulation results with the analytic solutions and experiment results. The recording pulse width which strongly affects the third relative harmonic content in the magnetic signals is then optimized to reduce the interpolation error. Experiment results show that the interpolation error is reduced with reduction of the third harmonic content by optimization of the recording pulse width. In addition, the results of this study suggest that the proposed method can derive optimum recording conditions for development of a high-accuracy magnetic encoder.