A diagnostic neutral beam (DNB) is applied to measure the plasma ion temperature and rotation speed in the HT-7 tokamak. Also, a heating neutral beam (HNB) is suggested as an effective method of heating a plasma for the EAST tokamak. As a necessary step to evaluate the required beam power in both applications, the attenuation of the injected neutral beam has been numerically calculated and analyzed considering the effect of various plasma parameters, such as electron temperature, electron density, impurity concentration, and so on. Three basic atomic processes are considered here. It is shown that at the same electron density neutral beam particles can penetrate deeper at higher injection energies and a DNB with the same full energy can attenuate faster at higher electron densities. The impurity effect on the attenuation of a DNB is discussed, and the attenuation of a HNB on the EAST tokamak is also considered.