A1-xSmxFe12-xCoxO19 (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanoparticles were prepared via sol-gel auto combustion meanwhile A1-xSmxFe12-xCoxO19/PANI (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanocomposites were synthesized by in situ polymerization. In order to achieve the required hexagonal and PANI structure, fourier transform infrared spectroscopy (FTIR) were manipulated. The bands at 400 and 500 cm−1 wavenumbers confirmed the formation of hexaferrites in all samples while two bands at 1463 and 1554 cm−1 wavenumber represented the existence of quinoid and benzenoid rings in A1-xSmxFe12-xCoxO19/PANI (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanocomposites. The X-ray diffraction spectroscopy (XRD) is in exact accordance with JCPDS No. 01-072-073 for Ba1-xSmxFe12-xCoxO19 (x = 0.03, 0.05, 0.07) and No. 00-024-1207 for Sr1-xSmxFe12-xCoxO19 (x = 0.03, 0.05, 0.07). The arising two novel peaks at 20 and 25° was the evidence for the PANI structure beside Ba and Sr hexaferrites peaks in A1-xSmxFe12-xCoxO19/PANI (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanocomposites. Field emission scanning electron microscopy (FESEM) of A1-xSmxFe12-xCoxO19 (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanoparticles indicated the complete hexagonal structure of hexaferrites. In A1-xSmxFe12-xCoxO19/PANI (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanocomposites the sphere particles of PANI covered the unabridged hexagonal shape of hexaferrites. The magnetic properties of products were measured by vibrating sample magnetometer (VSM). The saturation magnetization of A1-xSmxFe12-xCoxO19 (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanoparticles modified erratically. By adding non-magnetic PANI, the saturation magnetization decreased. The photocatalytic properties of A1-xSmxFe12-xCoxO19 (A = Ba, Sr, and x = 0.03, 0.05, 0.07) nanoparticles revealed that insertion of rare earth increased the photodegradation of methylene blue, while polymerization promoted the degradation process in A1-xSmxFe12-xCoxO19/PANI (A = Ba, Sr, and x = 0.03, 0.05, 0.07).