The mixed-case palletization problem is a common problem in warehousing and logistics where boxes of rectangular shapes are stacked on top of each other to form pallets. The problem shares common features with three-dimensional bin packing but requires boxes to be adequately supported. We propose a mixed integer programming formulation that maximizes the density of the bottom layers and the compactness of the pallet to ensure stability for top layers. We use a relative-position formulation with slicing that minimizes height, maximizes the fill rate of slices, and pushes boxes towards the vertical axis in order to consolidate fragmented space. Apart from common non-overlap and dimension-related constraints, we explicitly model the fill rates and force lower slices to have an equal or higher density than upper slices. As expected, the formulation could only handle small instances. To tackle larger instances, we embedded the formulation in an iterative approach that packs subsets of boxes sequentially. The approach was found to provide stable pallets and to outperform the branch-and-bound approach of Martello et al. (Oper Res 48(2):256–267, 2000).