During International Ocean Discovery Program (IODP) expeditions, shipboard-generated data provide the first insights into the cored sequences. The natural gamma radiation (NGR) of the recovered material, for example, is routinely measured on the ocean drilling research vessel DV JOIDES Resolution. At present, only total NGR counts are readily available as shipboard data, although full NGR spectra (counts as a function of gamma-ray energy level) are produced and archived. These spectra contain unexploited information, as one can estimate the sedimentary contents of potassium (K), thorium (Th), and uranium (U) from the characteristic gamma-ray energies of isotopes in the 40 K, 232 Th, and 238 U radioactive decay series. Dunlea et al. (2013) quantified K, Th, and U contents in sediment from the South Pacific Gyre by integrating counts over specific energy levels of the NGR spectrum. However, the algorithm used in their study is unavailable to the wider scientific community due to commercial proprietary reasons. Here, we present a new MATLAB algorithm for the quantification of NGR spectra that is transparent and accessible to future NGR users. We demonstrate the algorithm's performance by comparing its results to shore-based inductively coupled plasma-mass spectrometry (ICP-MS), inductively coupled plasma-emission spectrometry (ICP-ES), and quantitative wavelength-dispersive X-ray fluorescence (XRF) analyses. Samples for these comparisons come from eleven sites (U1341, U1343, U1366-U1369, U1414, U1428-U1430, and U1463) cored in two oceans during five expeditions. In short, our algorithm rapidly produces detailed high-quality information on sediment properties during IODP expeditions at no extra cost.