Polyaniline nanofibers (PAni NFs) were successfully prepared using a hydrothermal technique. The spin-coating method was employed for depositing polyaniline nanofibers in different solvents such as water, 2-methoxyethanol and ethanol. During this process, surface morphological, optical, structural, and hydrogen sulfide (H2S) gas-sensing properties have been investigated for the polyaniline nanofibers. The results of the x-ray diffraction pattern showed a peak around 2θ ∼25°, which is referred to the (200) desirable direction for all samples. A field-emission scanning electron microscopy analysis of PAni showed NFs as a structure for all the films. Fourier-transform Infrared patterns confirmed the creation of the PAni. The preparation process of PAni NFs using water showed that a smaller energy gap value was realized during the optical properties examination. What is more, the solvent absorption studies indicated that the highest energy gap value was realized for 2-methoxyethanol. The H2S gas-sensing properties of PAni NFs films showed high sensitivity (23.67%) being achieved at the operating temperature of 150°C with a very fast recovery time and response time for PAni NFs that were prepared using water.