A diffractive laser cavity mirror is described that can customize the amplitude and phase of a laser mode. The design of this diffractive element is shown for a square, flat-topped fundamental mode. The laser cavity has a theoretical fundamental mode loss of only 0.08% and a second-order mode loss of 48.2%, resulting in high modal discrimination. The fabricated mirror is tested in a Nd:YAG laser system. The resulting square flat-topped mode has an rms variation of 1.5% over the two-dimensional flat-topped region and a large discrimination against higher-order modes.