Abstract The design of diffractive phase elements (DPEs) for solving the general beam shaping problem where the signal wave is specified by an intensity distribution on a continuous support in a finite signal window is considered. In this case serious design problems due to speckles may arise. After introducing a mathematical definition and description of speckles, the influence of the phase of the signal wave on the design process is examined. It turns out that depending on the application a pseudo-random or a spherical phase should be used as an initial phase of the signal wave for an iterative design procedure. Due to its smoothness the spherical phase prevents the occurrence of speckles during the iteration process whereas the pseudo-random phase is accompanied by speckle effects. For applications where the imaging properties of the spherical phase are undesirable, a soft coding method is presented which significantly reduces the number of speckles of the pseudo-random phase. For cases where speckles ...