Precisely aligned optical components are crucial prerequisites for X-ray tomography at high resolution. We propose a device with a fractal pattern for precise automatic focusing. The device is etched in a Si substrate by deep reactive ion etching and then filled by a self-terminating bottom-up Au electroplating process. The fractal nature of the device produces an X-ray transmission image with globally homogeneous macroscopic visibility and high local contrast for pixel sizes in the range of 0.165 µm to 11 µm, while the high absorption contrast provided between Au and Si enables its use for X-ray energies ranging from 12 keV to 40 keV.