The third-order nonlinear optical properties of polyaniline (PANI) solutions and films were investigated at 532 nm by use of Z-scan, power limiting, and optical Kerr gate techniques. The polymers studied were the undoped partially oxidized (emeraldine base) and fully reduced (leucoemeraldine base) forms of PANI. Our results demonstrate that the leucoemeraldine base is more suitable for use in devices such as all-optical switches and optical power limiters operating at 532 nm. The worse performance of the emeraldine base is due to the presence of defects inside the bandgap of the polymer.