The high peak brilliance and femtosecond pulse duration of X-ray free-electron lasers (XFELs) provide new scientific opportunities for experiments in physics, chemistry and biology. In structural biology, one of the major applications is serial femtosecond crystallography. The intense XFEL pulse results in the destruction of any exposed microcrystal, making serial data collection mandatory. This requires a high-throughput serial approach to sample delivery. To this end, a number of such sample-delivery techniques have been developed, some of which have been ported to synchrotron sources, where they allow convenient low-dose data collection at room temperature. Here, the current sample-delivery techniques used at XFEL and synchrotron sources are reviewed, with an emphasis on liquid injection and high-viscosity extrusion, including their application for time-resolved experiments. The challenges associated with sample delivery at megahertz repetition-rate XFELs are also outlined.