A theory for the initial rate of second-harmonic generation (SHG) in planar optical waveguides for phase-matched and nonphase-matched cases is derived. The derivation is carried out both by a ray treatment and by a wave treatment and the results of the two are compared. Although formally and from the point of view of physical interpretation the two treatments look very different, the final results are the same if allowance is made for the Goos-Haenchen shift. Dependences of the amplitude of the second harmonic on the amplitude of the fundamental Aωand on distance are quite similar to those for bulk SHG even though the phase-matching condition is quite different. Determining the characteristics of some of the phase-matched modes, we find that, for the same Aω, it is possible to obtain a generation rate in waveguide comparable to that in the bulk. The highest generation rate is achieved, as expected, with both fundamental and harmonic having mode number 0. Phase matching can be achieved in this case without birefringence and with all three media having normal dispersion. The decrease in generation rate in going to mode pairs other than 0,0 is less than a factor 2 in some cases.