A maximum principle is introduced that enables approximate solutions to be found for boundary value problems involving plastic compaction. All that is required from the user is an adjustable stress field that obeys both equilibrium and the static boundary conditions, and an adjustable displacement field that obeys the kinematic boundary conditions. An approximate solution can then be found by adjusting the stress and displacement fields to obtain the maximum value of a volume integral by using standard optimisation methods. Two examples of its use are given: the compaction of a granular material around a cylindrical mandrel, and the compaction of granular material by its own weight in a deep parallel sided bin. The latter example demonstrates the validity of the maximum principle even when frictional boundary conditions are present.