A three-dimensional nonlinear simulation code to treat multiple frequencies simultaneously is described and used to study nonlinear harmonic generation in free-electron lasers (FELs). Strong nonlinear harmonic gain is found where the gain length varies inversely with the harmonic number. Substantial power levels are found in the harmonics. The odd harmonics are favored with generally higher power levels since a planar wiggler geometry is employed; however, the second harmonic exhibits substantial power as well. The analysis is relevant to the emission expected from self-amplified spontaneous emission (SASE) free-electron laser schemes.