An encoder comprising: a scale that includes a pattern area that has a first pattern row having a plurality of patterns which are arranged in a first modulation period in a moving direction and a second pattern row having a plurality of patterns which are arranged in a second modulation period different from the first modulation period in the moving direction, the plurality of patterns in the first and second pattern rows being configured to spatially modulate an energy distribution; a detector array that includes a plurality of detectors that are configured to detect the energy distribution from both the first pattern row and the second pattern row and arranged in the moving direction, the detector array and the scale being configured to move relatively to each other; and a signal processor configured to process and convert into positional information, an output signal from the detector array, wherein the signal processor includes: a first phase acquirer configured to acquire a first phase of the first modulation period based on the output signal of the detector array; a second phase acquirer configured to acquire a second phase of the second modulation period based on the output signal from the detector array; and a positional information acquirer configured to generate a Vernier signal Sv as a position signal that represents a position of the scale in the moving direction, based on the first and second phases, wherein the Vernier signal Sv satisfies: Sv = A ⋅ Φ 1 − B ⋅ Φ 2 where A and B are coefficients that satisfy A/B=n/m using integers m and n that satisfy: | m ⋅ P 1 − n ⋅ P 2 | < | P 1 − P 2 |, where Φ1 is the first phase acquired by the first phase acquirer, Φ2 is the second phase acquired by the second phase acquirer, P1 is the first modulation period, and P2 is the second modulation period. a scale that includes a pattern area that has a first pattern row having a plurality of patterns which are arranged in a first modulation period in a moving direction and a second pattern row having a plurality of patterns which are arranged in a second modulation period different from the first modulation period in the moving direction, the plurality of patterns in the first and second pattern rows being configured to spatially modulate an energy distribution; a detector array that includes a plurality of detectors that are configured to detect the energy distribution from both the first pattern row and the second pattern row and arranged in the moving direction, the detector array and the scale being configured to move relatively to each other; and a signal processor configured to process and convert into positional information, an output signal from the detector array, wherein the signal processor includes: a first phase acquirer configured to acquire a first phase of the first modulation period based on the output signal of the detector array; a second phase acquirer configured to acquire a second phase of the second modulation period based on the output signal from the detector array; and a positional information acquirer configured to generate a Vernier signal Sv as a position signal that represents a position of the scale in the moving direction, based on the first and second phases, wherein the Vernier signal Sv satisfies: Sv = A ⋅ Φ 1 − B ⋅ Φ 2 where A and B are coefficients that satisfy A/B=n/m using integers m and n that satisfy: | m ⋅ P 1 − n ⋅ P 2 | < | P 1 − P 2 |, where Φ1 is the first phase acquired by the first phase acquirer, Φ2 is the second phase acquired by the second phase acquirer, P1 is the first modulation period, and P2 is the second modulation period. a first phase acquirer configured to acquire a first phase of the first modulation period based on the output signal of the detector array; a second phase acquirer configured to acquire a second phase of the second modulation period based on the output signal from the detector array; and a positional information acquirer configured to generate a Vernier signal Sv as a position signal that represents a position of the scale in the moving direction, based on the first and second phases, wherein the Vernier signal Sv satisfies: Sv = A ⋅ Φ 1 − B ⋅ Φ 2 where A and B are coefficients that satisfy A/B=n/m using integers m and n that satisfy: | m ⋅ P 1 − n ⋅ P 2 | < | P 1 − P 2 |, where Φ1 is the first phase acquired by the first phase acquirer, Φ2 is the second phase acquired by the second phase acquirer, P1 is the first modulation period, and P2 is the second modulation period.