We investigate the E/B decomposition of CMB polarization on a masked sky . In real space , operators of E and B mode decomposition involve only differentials of CMB polarization . We may , therefore in principle , perform a clean E/B decomposition from incomplete sky data . Since it is impractical to apply second derivatives to observation data , we usually rely on spherical harmonic transformation and inverse transformation , instead of using real-space operators . In spherical harmonic representation , jump discontinuities in a cut sky produces Gibbs phenomenon , unless a spherical harmonic expansion is made up to an infinitely high multipole . By smoothing a foreground mask , we may suppress the Gibbs phenomenon effectively in a similar manner to apodization of a foreground mask discussed in other works . However , we incur foreground contamination by smoothing a foreground mask , because zero-value pixels in the original mask may be rendered non-zero by the smoothing process . In this work , we investigate an optimal foreground mask , which ensures proper foreground masking and suppresses Gibbs phenomenon . We apply our method to a simulated map of the pixel resolution comparable to the Planck satellite . The simulation shows that the leakage power is lower than unlensed CMB B mode power spectrum of tensor-to-scalar ratio r \sim 1 \times 10 ^ { -7 } . We compare the result with that of the original mask . We find that the leakage power is reduced by a factor of 10 ^ { 6 } \sim 10 ^ { 9 } at the cost of a sky fraction 0.07 , and that that the enhancement is highest at lowest multipoles . We confirm that all the zero-value pixels in the original mask remain zero in our mask . The application of this method to the Planck data will improve the detectability of primordial tensor perturbation .