A compaction scheme, based on the concept of compression ridges (CRs) is presented. The virtual grid-based stick diagram of a layout is first converted automatically into a detailed layout which confirms to the design rules. All CRs are enumerated in both X and Y directions and their widths are calculated. The technique for choosing the CR to use for squeezing is based on the fact that a CR not only reduces area based on its width and length, but may also preempt the reduction by some other CRs, both in the same and orthogonal directions. Each CR is associated with a weight that signifies a measure of the net reduction in area that is possible: the CR with maximum weight is chosen to compact at each step.