A self-consistent time-dependent unrestricted Hartree–Fock (TDUHF) theory of linear and nonlinear optical properties is presented. Expressions are derived to calculate the elements of the linear polarizability tensor α, the first-hyperpolarizability tensor β, and the second-hyperpolarizability tensor γ, in terms of spin-adapted perturbed density matrices. For the hyperpolarizability tensors, β and γ, expressions are also derived from the lower-order solutions to the TDUHF equations. A novel feature of the present formulation is that it automatically allows for the separation of the contributions to (hyper)polarizability tensors from individual spin. Results obtained from the calculations of α(ωσ;αa) for H, C, N, O, F, Si, P, S, Cl, O2, NO, and OH and of β(−ωσ;ωa,ωb) corresponding to various second-order nonlinear optical processes for NO and OH radicals are presented. The present results for α show excellent agreement with the literature data. The calculated result for β∥ in the case of the NO radical is too small and has a different sign in comparison to the published experimental data. For both NO and OH, the β tensor for different second-order nonlinear optical processes show the order: β(−2ω;ω,ω)≳β(−ω;0,ω) ≡β(0;ω,−ω)≳β(0;0,0).