Treatment of acute malnutrition typically requires the provision of ready-to-use food (RUF). Common RUF is effective but expensive, being manufactured from costly ingredients, and shipped worldwide from few global suppliers. I developed a linear programming tool to create RUF optimized for low cost using locally grown crops while maintaining necessary nutritional goals and other constraints. My tool utilizes a database of the nutritional value, price, and water efficiency of suitable ingredients and allows adjustment of constraints, including nutrients, flavour, and crop water efficiency. It is designed to (a) address nutrient requirements conforming to current standards and practice; (b) optimize RUF formulae for low cost using a wide range of ingredients for nutritional value and acceptability improvement; (c) ensure protein quality through protein digestibility corrected amino acid score; and (d) adjust RUF formulae according to locally grown crop selection, local prices, and crop water footprint. The tool creates formulae free of expensive dairy ingredients, ensuring desired protein digestibility corrected amino acid score by automatically balancing proteins with complementary quantities of essential amino acids. Using publicly available data with an application to Nigeria, my tool created RUF formulae suitable for local production using local crops to meet all nutrient requirements at a fraction of the ingredient cost and water footprint of current formulae, demonstrating the tool's effectiveness. Optimization of RUF for low cost using locally grown crops will facilitate local production and reduce ingredient as well as transport costs, so more patients can receive lifesaving treatment.