We study metal depletion due to dust in the interstellar medium (ISM) to infer the properties of dust grains and characterize the metal and dust content of galaxies down to low metallicity and intermediate redshift z. We provide metal column densities and abundances of a sample of 70 damped Lyman-α absorbers (DLAs) towards quasars, observed at high spectral resolution with the Very Large Telescope (VLT) Ultraviolet and Visual Echelle Spectrograph (UVES). This is the largest sample of phosphorus abundances measured in DLAs so far. We use literature measurements for Galactic clouds to cover the high-metallicity end. We discover tight (scatter 0.2 dex) correlations between [Zn/Fe] and the observed relative abundances from dust depletion. This implies that grain growth in the ISM is an important process of dust production. These sequences are continuous in [Zn/Fe] from dust-free to dusty DLAs, and to Galactic clouds, suggesting that the availability of refractory metals in the ISM is crucial for dust production, regardless of the star formation history. We observe [S/Zn] up to ∼ 0.25 dex in DLAs, which is broadly consistent with Galactic stellar abundances. Furthermore, we find a good agreement between the nucleosynthetic pattern of Galactic halo stars and our observations of the least dusty DLAs. This supports recent star formation in low-metallicity DLAs. The derived depletions of Zn, O, P, S, Si, Mg, Mn, Cr, and Fe correlate with [Zn/Fe], with steeper slopes for more refractory elements. P is mostly not affected by dust depletion. We present canonical depletion patterns to be used as reference in future studies of relative abundances and depletion. We derive the total (dust-corrected) metallicity, typically −2 [M/H] tot 0 for DLAs, and scattered around solar metallicity for the Galactic ISM. The dust-to-metal ratio (DTM) increases with metallicity, again supporting the importance of grain growth for dust production. The dust extinction A V derived from the depletion is typically < 0.2 mag in DLAs. Finally, we derive elemental abundances in dust, which is key to understanding the dust composition and its evolution. We observe similar abundances of Mg, Si, and Fe in dust; this suggests that grain species such as pyroxenes and iron oxides are more important than olivine, but this needs to be confirmed by more detailed analysis. Overall, we characterize dust depletion, nucleosynthesis, and dust-corrected metallicity in DLAs, providing a unified picture from low-metallicity systems to the Galactic ISM.