Slaughterhouses are major players in the pork supply chain, and supply and demand must be matched in order to generate the highest proﬁt. In particular, carcasses must be sorted in order to produce the “right” ﬁnal products from the “right” carcasses. We develop a mixed-integer programming (MIP) model for computing the optimal sorting of carcasses according to two parameters; slaughter weight and fat layer. Moreover, we consider a new approach for dealing with expected measurement errors. The results provide insight into how sorting groups should be designed in order to improve the proﬁt at slaughterhouses. Finally, we comment on the expected effect of variations in the raw material supply and the demand as well as future research concerning joint modelling of supply chain aspects.