An X-ray imaging apparatus includes an X-ray irradiating unit configured to irradiate an X-ray to an object, an X-ray detecting unit configured to detect the irradiated X-ray, an image creating unit configured to create X-ray image data based on data detected by the X-ray detecting unit, a moving mechanism configured to move the X-ray detecting unit to the object, a capacitance sensing unit, including an electrode which is positioned so as to cover at least part of a detection plane of the X-ray detecting unit, configured to obtain a capacitance value of the X-ray detecting unit by the electrode and a distance measurement unit configured to measure a distance between the object and the X-ray detecting unit based on the capacitance value.