Dipole moment, polarizability, and first-order hyperpolarizability of cyclic imides (maleimide, succinimide, phthalimide and some of their derivatives) have been investigated using ab initio and density functional theory calculations. It is found that 4,5-dichloro-, and 3,4,5,6-tetrachlorophthalimide have highest mean polarizabilities and total hyperpolarizabilities among the studied molecules. Furthermore, polarized continuum model has been employed to investigate solvent effects on the nonlinear optical (NLO) properties of succinimide; results indicate that solvent polarity has considerable influence on the NLO response of the molecules.