[Problems to be Solved] To provide a rotary encoder capable of carrying out self-calibration for a horizontal encoder as well as a vertical encoder without requiring special equipment and simply and inexpensively with a high degree of accuracy while reducing the burden on a worker.