Motivated by recent experiments we derive an exact expression for the correlation function entering the three-body recombination rate for a one-dimensional gas of interacting bosons. The answer, given in terms of two thermodynamic parameters of the Lieb-Liniger model, is valid for all values of the dimensionless coupling $gamma$ and contains the previously known results for the Bogoliubov and Tonks-Girardeau regimes as limiting cases. We also investigate finite-size effects by calculating the correlation function for small systems of 3, 4, 5 and 6 particles.