The X-ray imaging apparatus may include at least one X-ray detector including a storage unit configured to store ID information and a mounting position detecting unit; at least one mounting unit in which the X-ray detector is mounted; and a control unit configured to determine which X-ray detector among the at least one X-ray detector is mounted in which mounting unit among the at least one mounting unit based on the ID information and an output value of the mounting position detecting unit.