We use recent developments in the framework of a time-dependent matrix product state method to compute the nuclear magnetic resonance relaxation rate 1/T 1 for spin-1/2 chains under magnetic field and for different Hamiltonians (XXX, XXZ, isotropically dimerized). We compute numerically the temperature dependence of the 1/T 1 . We consider both gapped and gapless phases, and also the proximity of quantum critical points. At temperatures much lower than the typical exchange energy scale, our results are in excellent agreement with analytical results, such as the ones derived from the Tomonaga-Luttinger liquid (TLL) theory and bosonization, which are valid in this regime. We also cover the regime for which the temperature T is comparable to the exchange coupling. In this case analytical theories are not appropriate, but this regime is relevant for various new compounds with exchange couplings in the range of tens of Kelvin. For the gapped phases, either the fully polarized phase for spin chains or the low-magnetic-field phase for the dimerized systems, we find an exponential decrease in /(k B T ) of the relaxation time and can compute the gap . Close to the quantum critical point our results are in good agreement with the scaling behavior based on the existence of free excitations.