PROBLEM TO BE SOLVED: To provide an X-ray detector or an X-ray imaging device that can accurately detect a defective element before photographing an image by irradiating a detected object with an X-ray.SOLUTION: An X-ray detector comprises: X-ray detection substrates 126 and 125 that detect an X-ray and have an X-ray detection element for generating an electric charge in accordance with intensity of the detected X-ray arranged in a matrix an X-ray collimator 120 that is arranged on an incident surface side of the X-ray in the X-ray detection substrates 126 and 125 and limits an incident direction of the X-ray and a light irradiation part that has a light emitting part 122 arranged to face respective X-ray detection elements 128 and 127. The X-ray detection elements 128 and 127 form the electric charge in accordance with light to be irradiated from the light emitting part 122. By using the electric charge, a determination of the defective pixel is performed.