Galaxies in the Universe are distributed in a web-like structure characterized by different large-scale environments: dense clusters, elongated filaments, sheetlike walls and under-dense regions, called voids1–5. The low density in voids is expected to affect the properties of their galaxies. Indeed, previous studies6–14 have shown that galaxies in voids are, on average, bluer and less massive, and have later morphologies and higher current star formation rates than galaxies in denser large-scale environments. However, it has never been observationally proved that the star formation histories (SFHs) in voids are substantially different from those in filaments, walls and clusters. Here we show that void galaxies have had, on average, slower SFHs than galaxies in denser large-scale environments. We also find two main SFH types present in all the environments: ‘short-timescale’ galaxies are not affected by their large-scale environment at