To solve a difference in an emitting directions by switching the types of X-rays. An X-ray generator comprises: an anticathode unit 3 in which a plurality of anticathode parts 2 (2A and 2B) that emit X-rays by collision of thermoelectrons are disposed side by side; a cathode 4 for releasing the thermoelectrons toward the anticathode parts 2A and 2B on the anticathode unit 3; and a cathode moving mechanism that switches the anticathode parts, against which the thermoelectrons from the cathode 4 collide by moving the cathode 4 along the diction of aligning anticathode parts 2A and 2B. In such an X-ray generator, an optical element 6 is arranged, which emits incident X-rays R1 and R2, in a taking-out route of the X-rays emitted from the anticathode parts 2, as diffracted X-rays R11 and R12, and also an adjustment mechanism 7 that aligns emitting directions of the diffracted X-rays with respect to the incident X-rays emitted from each anticathode part, to one direction, when the anticathode parts, against which the thermoelectrons from the cathode collide, are switched by moving the cathode.