X-ray mirrors are widely used at synchrotron radiation sources for focusing X-rays into focal spots of size less than 1 mm. The ability of the beamline optics to change the size of this spot over a range up to tens of micrometres can be an advantage for many experiments such as X-ray microprobe and X-ray diffraction from micrometre-scale crystals. It is a requirement that the beam size change should be reproducible and it is often essential that the change should be rapid, for example taking less than 1 s, in order to allow high data collection rates at modern X-ray sources. In order to provide a controlled broadening of the focused spot of an X-ray mirror, a series of refractive optical elements have been fabricated and installed immediately before the mirror. By translation, a new refractive element is moved into the X-ray beam allowing a variation in the size of the focal spot in the focusing direction. Measurements using a set of prefabricated refractive structures with a test mirror showed that the focused beam size could be varied from less than 1 mm to over 10 mm for X-rays in the energy range 10-20 keV. As the optics is in-line with the X-ray beam, there is no effect on the centroid position of the focus. Accurate positioning of the refractive optics ensures reproducibility in the focused beam profile and no additional re-alignment of the optics is required.