Direct functionalization of C(sp3)–H bonds allows rapid access to valuable products, starting from simple petrochemicals. However, the chemical transformation of non-activated methylene groups remains challenging for organic synthesis. Here, we report a general electrochemical method for the oxidation of C(sp3)–H and C(sp2)–H bonds, in which cyclic alkanes and (cyclic) olefins are converted into cycloaliphatic ketones as well as aliphatic (di)carboxylic acids. This resource-friendly method is based on nitrate salts in a dual role as anodic mediator and supporting electrolyte, which can be recovered and recycled. Reducing molecular oxygen as a cathodic counter reaction leads to efficient convergent use of both electrode reactions. By avoiding transition metals and chemical oxidizers, this protocol represents a sustainable oxo-functionalization method, leading to a valuable contribution for the sustainable conversion of petrochemical feedstocks into synthetically usable fine chemicals and commodities.