We consider the NP-complete problem of finding an enclosing rectangle of minimum area that will contain a given a set of rectangles. We present two different constraintsatisfaction formulations of this problem. The first searches a space of absolute placements of rectangles in the enclosing rectangle, while the other searches a space of relative placements between pairs of rectangles. Both approaches dramatically outperform previous approaches to optimal rectangle packing. For problems where the rectangle dimensions have low precision, such as small integers, absolute placement is generally more efficient, whereas for rectangles with high-precision dimensions, relative placement will be more effective. In two sets of experiments, we find both the smallest rectangles and squares that can contain the set of squares of size 1 × 1, 2 × 2, . . . , N × N , for N up to 27. In addition, we solve an open problem dating to 1966, concerning packing the set of consecutive squares up to 24 × 24 in a square of size 70 × 70. Finally, we find the smallest enclosing rectangles that can contain a set of unoriented rectangles of size 1 × 2, 2 × 3, 3 × 4, . . . , N × (N + 1), for N up to 25.