We analyze the thermal conductivity of anisotropic and frustrated spin-1/2 chains using analytical and numerical techniques. This includes mean-field theory based on the Jordan-Wigner transformation, bosonization, and exact diagonalization of systems with N ≲ 18 sites. We present results for the temperature dependence of the zero-frequency weight of the conductivity for several values of the anisotropy Δ. In the gapless regime, we show that the mean-field theory compares well to known results and that the low-temperature limit is correctly described by bosonization. In the antiferromagnetic and ferromagnetic gapped regime, we analyze the temperature dependence of the thermal conductivity numerically. The convergence of the finite-size data is remarkably good in the ferromagnetic case. Finally, we apply our numerical method and mean-field theory to the frustrated chain where we find a good agreement of these two approaches on finite systems. Our numerical data do not yield evidence for a diverging thermal conductivity in the thermodynamic limit in case of the antiferromagnetic gapped regime of the frustrated chain.