X-ray computed tomography (CT) can reveal the internal details of objects in three dimensions non-destructively. In this Primer, we outline the basic principles of CT and describe the ways in which a CT scan can be acquired using X-ray tubes and synchrotron sources, including the different possible contrast modes that can be exploited. We explain the process of computationally reconstructing three-dimensional (3D) images from 2D radiographs and how to segment the 3D images for subsequent visualization and quantification. Whereas CT is widely used in medical and heavy industrial contexts at relatively low resolutions, here we focus on the application of higher resolution X-ray CT across science and engineering. We consider the application of...