Line-edge roughness (LER) is often measured from top-down critical dimension scanning electron microscope (CD-SEM) images. The true three-dimensional roughness profile of the sidewall is typically ignored in such analyses. We study the response of a CD-SEM to sidewall roughness (SWR) by simulation. We generate random rough lines and spaces, where the SWR is modelled by a known power spectral density. We then obtain corresponding CD-SEM images using a Monte Carlo electron scattering simulator. We find the measured LER from these images, and compare it to the known input roughness. We find that, for isolated lines, the SEM measures the outermost extrusion of the rough sidewall. The result is that the measured LER is up to a factor 2 less than the true on-wafer roughness. The effect can be accurately modelled by making a top-down projection of the rough edge. Our model for isolated lines works fairly well for a dense grating of lines and spaces, as long as the trench width exceeds the line height.