We report subpicosecond electro-optic measurements of the length of individual relativistic electron bunches. The longitudinal electron-bunch shape is encoded electro-optically on to the spectrum of a chirped laser pulse. The electron-bunch length is determined by analyzing individual laser-pulse spectra obtained with and without the presence of an electron bunch. Since the length of the chirped laser pulse can be easily changed, the electron bunch can be visualized on different time scales. This single-shot imaging technique is a promising method for real-time electron-bunch diagnostics.