This study investigated the production conditions of a potassium magnesium phosphate fertilizer with vinasse (a by-product of the sugar or ethanol industry) and grape marc (a by-product of the wine-making industry). A mixture of vinasse and grape marc was subjected to pyrolysis under a nitrogen gas atmosphere, and water was used to extract potassium from the end product. Potassium magnesium phosphate (potassium-struvite, KMgPO4 center dot 6H(2)O), a slow-release fertilizer compound, was obtained from the extract with potassium to explore process conditions and product characteristics. Producing fertilizer products from residual materials is of paramount significance for conserving natural resources. The mixture was pyrolyzed, allowing us to remove potassium from the complex matrix of concentrated vinasse to a clear and high alkaline solution. The residual carbon was activated by decomposing (pyrolysis) and treating the residue and then washing it with water. The extract had high alkalinity, suggesting that the potassium in the mixture resulted in carbon activation during biomass pyrolysis. Pyrolysis and treatment can be used to produce activated carbon from vinasse. This study also investigated the solubility of vinasse in water and aqueous solutions. K-struvite with 10.67 % K20 was about 2% soluble in water, indicating that the end product was a slow-release fertilizer agent. In conclusion, this process can be used to produce potassium (a slow-release fertilizer) and activated carbon (a by-product) from vinasse for different purposes. (C) 2021 Institution of Chemical Engineers. Published by Elsevier B.V. All rights reserved.