An X-ray detector according to one embodiment includes X-ray detector modules, and a frame. Each X-ray detector module has a detection surface on which detection elements configured to detect X-rays are arrayed, and a supporter configured to support the detection elements. The frame fixes positions of the X-ray detector modules in such a manner that the detection surfaces of the X-ray detector modules are aligned along a first direction. The frame is provided with a pin protruding toward the supporter, at a position to which the supporter is fixed. The supporter is provided with a hole through which and into which the pin is inserted and fitted, at a position facing the frame. A movement of the supporter in the first direction is restricted by fitting the pin provided to the frame into the hole provided to the supporter, when the supporter is attached to the frame.