Despite the small continental coverage of lakes, they are hotspots of carbon cycling, largely due to the processing of terrestrially derived dissolved organic matter (DOM). As DOM is an amalgam of heterogeneous compounds comprising gradients of microbial and physicochemical reactivity, the factors influencing DOM processing at the molecular level and the resulting patterns in DOM composition are not well understood. Here we show, using ultrahigh-resolution mass spectrometry to unambiguously identify 4,032 molecular formulae in 120 lakes across Sweden, that the molecular composition of DOM is shaped by precipitation, water residence time and temperature. Terrestrially derived DOM is selectively lost as residence time increases, with warmer temperatures enhancing the production of nitrogen-containing compounds. Using biodiversity concepts, we show that the molecular diversity of DOM, or chemodiversity, increases with DOM and nutrient concentrations. The observed molecular-level patterns indicate that terrestrially derived DOM will become more prevalent in lakes as climate gets wetter.