The paper describes an experimental setup designed to measure the thickness of metal and organic foils with an accuracy close to 3 µm. The working principle of the setup is based on the interaction between X-ray radiation and matter, specifically the reduction in X-ray intensity as it passes through a material layer. The setup allows for the control of the energy of the incident X-ray radiation within the range of 5 to 30 keV. Additionally, it can detect inhomogeneities in the foil by analysing the recorded spectrum of the X-ray radiation that has passed through the foil. For organic foils such as carbon fiber or mylar, the setup operates in the soft X-ray range up to 10 keV, utilising energy dispersive analysis of the X-ray signal that is transmitted through and scattered by the object under study.