We present a method to design polarization-independent multilayer dielectric gratings. In this method the reflection phases in TE and TM polarizations of the multilayer stack thread surface-relief grating at the top and the multilayer stack at the bottom together, allowing the two parts first to be designed separately and efficiently, and then to be combined to achieve simultaneously high diffraction efficiency and large fabrication tolerance. We find numerically that in general a periodic stack is unable to provide the top-grating-demanded phase difference between TM and TE polarizations; adequate aperiodic layers atop of a periodic stack are needed. The analytic diffraction efficiency formula of a recent work [J. Opt. Soc. Am. A 41, 252 (2024)] is used at various places of the presented optimization algorithm to save computation time. An example grating with rectangular surface-relief profile and another with trapezoidal profile were successfully designed, validating the effectiveness of this design method.