An important class of dielectric optical waveguides has stepped refractive index profiles. For these waveguides we present a new finite-difference approach free of spurious modes. The coupled difference equations are formulated in terms of the transverse magnetic field components H(x) and H(y). We show how the boundary conditions can be formulated and included in the finite difference scheme to obtain a unique set of equations. For a step-index fiber a comparison of the numerical results with the analytical solution shows that the relative error in the propagation constant is as low as 4.4 x 10(-7) for an index difference of 7.3%. For a rib waveguide, we compare our results with previously published data based on other methods. Field plots of the dominant and the weak transverse field components of the magnetic field for the fundamental mode of a buried rib waveguide are also given.