According to one embodiment, an X-ray detector includes a plurality of detection packs and a plurality of heaters. Each of the detection packs includes a plurality of detection elements that detect X rays having passed through a subject and output a detection signal corresponding to the X rays and is arranged along a predetermined direction. Each of the heaters is provided corresponding to each of the detection packs and individually controls the temperature of each of the detection packs.