The nonlinear optical properties of two newly synthesized molecules 9-Ethyl-3-{2-[4-(2-Pyridin-4-yl-vinyl)-phenyl]-vinyl}-9H-carbazole (EPVPC) and 9-Octadecyl-3-{2-[4-(2-Pyridin-4-yl-vinyl)-phenyl]-vinyl}-9H-carbazole (OPVPC)have been studied with hybrid density functional theory (DFT/B3LYP). The generalized few-state model is employed to calculate the two-photon absorption cross sections of the compounds. The theoretical results are in good agreement with the available experimental measurements. It is found that the maximal two-photon absorption (TPA) cross sections of the compounds can be well described by a three-state model. The numerical simulation shows that both compounds have large two-photon absorption (TPA) cross sections and, furthermore, OPVPC displays a little stronger TPA activity than EPVPC in a lower frequency region.