Abstract We consider a constitutive model for the treatment of swelling in the context of compressible hyperelasticity. It is developed as an extension of the conventional compressible theory by an additional dependence of the stored energy function on the local natural free volume due to swelling. For such a material model, we study the cavitation problem in spherical symmetry. A closed-form solution for cavitation is obtained for a class of materials characterized by two constitutive parameters (one for shear stiffness and the other for bulk stiffness). It is shown that the incompressible description of cavitation and swelling for an elastic sphere is then obtained in the limit wherein the bulk stiffness goes to infinity. In the absence of swelling this limit retrieves a neo-Hookean description for the materials under consideration. If the bulk stiffness is relatively large but finite, then a description for nearly incompressible cavitation and swelling is obtained.