Context : In 2D-simulations of thin gaseous disks with embedded planets or self-gravity the gravitational potential needs to be smoothed to avoid singularities in the numerical evaluation of the gravitational potential or force . The softening prescription used in 2D needs to be adjusted properly to correctly resemble the realistic case of vertically extended 3D disks . Aims : We analyze the embedded planet and the self-gravity case and provide a method to evaluate the required smoothing in 2D simulations of thin disks . Methods : Starting from the averaged hydrodynamic equations and using a vertically isothermal disk model , we calculate the force to be used in 2D simulations . We compared our results to the often used Plummer form of the potential , which runs as \propto 1 / ( r ^ { 2 } + \epsilon ^ { 2 } ) ^ { 1 / 2 } . For that purpose we computed the required smoothing length \epsilon as a function of distance r to the planet or to a disk element within a self-gravitating disk . Results : We find that for longer distances \epsilon is determined solely by the vertical disk thickness H . For the planet case we find that outside r \approx H a value of \epsilon = 0.7 H describes the averaged force very well , while in the self-gravitating disk the value needs to be higher , \epsilon = 1.2 H . For shorter distances the smoothing needs to be reduced significantly . Comparing torque densities of 3D and 2D simulations we show that the modification to the vertical density stratification as induced by an embedded planet needs to be taken into account to obtain agreeing results . Conclusions : It is very important to use the correct value of \epsilon in 2D simulations to obtain a realistic outcome . In disk fragmentation simulations the choice of \epsilon can determine whether a disk will fragment or not . Because a wrong smoothing length can change even the direction of migration , it is very important to include the effect of the planet on the local scale height in 2D planet-disk simulations . We provide an approximate and fast method for this purpose that agrees very well with full 3D simulations .