A photoelectric encoder (1, 1a, 1b) comprising: a light source that emits light; a scale including bars arranged at a predetermined pitch in a length measurement direction, on which the light emitted by the light source is incident; an imaging optical system (4, 4a, 4b) on which the light that has passed through the scale is incident and which emits the incident light as collimated light; and a light receiver that receives the light emitted by the imaging optical system (4, 4a, 4b) such that a position of the scale in the length measurement direction can be detected, wherein the imaging optical system (4, 4a, 4b) constitutes a both-side telecentric optical system including a first planar reflective surface, a main mirror, which is a spherical concave mirror, a sub-mirror, which is a spherical convex mirror and has a center that coincides with a center of the main mirror, and a second planar reflective surface, wherein a ratio of a radius Rcc of a spherical surface of the main mirror to a radius Rcx of a spherical surface of the sub-mirror is Rcc:Rcx = n:n-1, where n is an integer that is greater than or equal to 2, and wherein, in the imaging optical system (4, 4a, 4b), the first planar reflective surface reflects the incident light, which has passed through the scale, toward the main mirror, the main mirror and the sub-mirror fold an optical path of the light from the first planar reflective surface by reflecting the light from the first planar reflective surface 2n-1 times between the main mirror and the sub-sub-mirror, the main mirror emits the light that has been reflected 2n-1 times toward the second planar reflective surface, and the second planar reflective surface reflects the light that has been reflected 2n-1 times and emitted by the main mirror toward the light receiver. a light source that emits light; a scale including bars arranged at a predetermined pitch in a length measurement direction, on which the light emitted by the light source is incident; an imaging optical system (4, 4a, 4b) on which the light that has passed through the scale is incident and which emits the incident light as collimated light; and a light receiver that receives the light emitted by the imaging optical system (4, 4a, 4b) such that a position of the scale in the length measurement direction can be detected, wherein the imaging optical system (4, 4a, 4b) constitutes a both-side telecentric optical system including a first planar reflective surface, a main mirror, which is a spherical concave mirror, a sub-mirror, which is a spherical convex mirror and has a center that coincides with a center of the main mirror, and a second planar reflective surface, a first planar reflective surface, a main mirror, which is a spherical concave mirror, a sub-mirror, which is a spherical convex mirror and has a center that coincides with a center of the main mirror, and a second planar reflective surface, wherein a ratio of a radius Rcc of a spherical surface of the main mirror to a radius Rcx of a spherical surface of the sub-mirror is Rcc:Rcx = n:n-1, where n is an integer that is greater than or equal to 2, and wherein, in the imaging optical system (4, 4a, 4b), the first planar reflective surface reflects the incident light, which has passed through the scale, toward the main mirror, the main mirror and the sub-mirror fold an optical path of the light from the first planar reflective surface by reflecting the light from the first planar reflective surface 2n-1 times between the main mirror and the sub-sub-mirror, the main mirror emits the light that has been reflected 2n-1 times toward the second planar reflective surface, and the second planar reflective surface reflects the light that has been reflected 2n-1 times and emitted by the main mirror toward the light receiver. the first planar reflective surface reflects the incident light, which has passed through the scale, toward the main mirror, the main mirror and the sub-mirror fold an optical path of the light from the first planar reflective surface by reflecting the light from the first planar reflective surface 2n-1 times between the main mirror and the sub-sub-mirror, the main mirror emits the light that has been reflected 2n-1 times toward the second planar reflective surface, and the second planar reflective surface reflects the light that has been reflected 2n-1 times and emitted by the main mirror toward the light receiver.