Prediction of shrinkage cavity in shaped castings considering solidification contraction has been considered to be one of the most important subjects in casting design. Several methods of prediction of the position and shape of shrinkage cavity in castings by computer simulation have been reported. However, most of them did not fully consider solidification contraction. Casting defects caused by volume contraction during solidification of molten metal are categorized into "shrinkage cavity" and "porosity", depending on their generation mechanism. This paper describes in detail a method for predicting the shape and position of shrinkage cavities and porosities in shaped castings both for pure metals and alloys. A computer program was developed to calculate the shape and dimension of shrinkage cavities in shaped castings. The potential of the present method has been successfully demonstrated by comparing predicted cavity shapes with those obtained in a series of experimental castings.