A focus detector for detecting a defocus amount of an image pickup optical system based on a displacement amount between a pair of images formed by a pair of light beams divided from the image pickup optical system and passed through a pair of pupil areas, the focus detector comprising: a pair of lenses; a pair of phase difference detecting sensors for photoelectrically converting a pair of subject images formed by the pair of lenses into a pair of image signals, wherein each of the image signals comprises a number of pixel values; a second correlation computing unit for computing correlation values between the pair of image signals in dependence of relative shifts between the pixel values of the pair of image signals and for computing one or more in-focus candidate points based on the correlation values, wherein for the computing of each of the correlation values a number of pixel values and the respective relative shift is taken into account; and a reference number-of-pixels selecting unit for selecting a reference number-of-pixels, wherein the reference number-of pixels is a smallest number of pixels among the number of pixels to be subject to correlation computation for which one or more in-focus candidate points are determined by the second correlation computing unit; a first correlation computing unit for dividing each of the pair of image signals based on the reference number-of-pixels to obtain respective divided areas and to compute a respective image displacement amount for each of the divided areas; a waveform coincidence degree computing unit for computing a respective coincidence degree of the pair of image signals in each of the divided areas based on the respective image displacement amounts; and a defocus amount computing unit for computing a defocus amount based on the coincidence degrees. a pair of lenses; a pair of phase difference detecting sensors for photoelectrically converting a pair of subject images formed by the pair of lenses into a pair of image signals, wherein each of the image signals comprises a number of pixel values; a second correlation computing unit for computing correlation values between the pair of image signals in dependence of relative shifts between the pixel values of the pair of image signals and for computing one or more in-focus candidate points based on the correlation values, wherein for the computing of each of the correlation values a number of pixel values and the respective relative shift is taken into account; and a reference number-of-pixels selecting unit for selecting a reference number-of-pixels, wherein the reference number-of pixels is a smallest number of pixels among the number of pixels to be subject to correlation computation for which one or more in-focus candidate points are determined by the second correlation computing unit; a first correlation computing unit for dividing each of the pair of image signals based on the reference number-of-pixels to obtain respective divided areas and to compute a respective image displacement amount for each of the divided areas; a waveform coincidence degree computing unit for computing a respective coincidence degree of the pair of image signals in each of the divided areas based on the respective image displacement amounts; and a defocus amount computing unit for computing a defocus amount based on the coincidence degrees.