A continuum mechanics theory is established for the in-surface buckling of one-dimensional nanomaterials on compliant substrates, such as silicon nanowires on elastomeric substrates observed in experiments. Simple analytical expressions are obtained for the buckling wavelength, amplitude and critical buckling strain in terms of the bending and tension stiffness of the nanomaterial and the substrate elastic properties. The analysis is applied to silicon nanowires, single-walled carbon nanotubes, multi-walled carbon nanotubes, and carbon nanotube bundles. For silicon nanowires, the measured buckling wavelength gives Young's modulus to be 140 GPa, which agrees well with the prior experimental studies. It is shown that the energy for in-surface buckling is lower than that for normal (out-of-surface) buckling, and is therefore energetically favorable.