Measure the distance from the wall's bottom plate to the wall's top plate in the space between two wall studs. Lay a piece of rigid foam insulation on a flat work surface. Transfer the measurement you just took to the foam insulation and make a small mark with a utility knife.
Lay a level across the foam, intersecting with the utility knife mark. Use the level as a straight edge as you cut through the foam.
Insert the rigid foam between the wall studs. The foam should fit tightly. If it seems loose, lay the rigid foam face down on a flat work surface. Apply a wiggly line of construction adhesive down the foam's back side.
Place the rigid foam back between the wall studs and press it firmly against the wall. Move to the next space between two wall studs and measure its height. Cut and install a second sheet of rigid foam insulation the same way you installed the first piece. Continue along the wall until each space between studs has been filled with rigid foam insulation.
Apply a strip of construction tape over the seam where the rigid foam insulation meets the wall stud. Do this on both sides of each piece of rigid foam insulation.