agricultural vehicles, which has led to increased risks of soil compaction. Hence, farmers benefit from machinery with higher capacity but may suffer from decreased yields caused by compaction. Compaction may result in further environmental costs to society. We present a framework that relates the machinery capacity to soil compaction and its impacts on crop yields and environmental disservices, and associated revenues and costs for farmers and society. We combined simulations using a soil compaction model and a soil-crop model with simple economic analyses. We applied the framework to a case study of cereal production in Sweden, to derive the optimal combine harvester size that maximizes the farmer’s private profit and the societal net benefit, respectively. Increased machinery size decreased harvesting costs, but also reduced simulated crop yields and thus crop revenue as a result of soil compaction. Furthermore, in the model simulations, compaction also increased surface run-off, nitrogen leaching and greenhouse gas emissions. Intermediate machinery size maximized the farmer’s net revenue. Net benefits for society were highest for the lowest possible compaction level, due to the considerable external costs from soil compaction. We show that the optimal machinery size and thus compaction level for maximum farmer revenue would decrease if either producer prices were higher, harvesting costs savings from larger machinery were smaller, or if farmers were charged for (part of the) environmental costs.