Based on the design of polyaniline structure, two different types of magnetic nanoparticles/polyaniline composites with electromagnetic absorption properties are prepared using the mechanical blending method based on protonic acid doping. Different sizes of FePt/PANI and Fe3O4/PANI composites with hollow structure are prepared by hard template method and mechanical blending method. The impact of the thickness of different shells on the absorbing property of composites is studied by adjusting the mass ratio of aniline/polystyrene. The research shows that the microspheres prepared with hollow structure have a fine morphology and uniform size and the average size is 1µm and 2µm respectively. With the increase of doping concentration, the minimum reflection loss peak shifts toward the low frequency and the corresponding matching thickness gradually becomes thicker. In addition, the loss mechanisms such as dielectric relaxation polarization, eddy current loss and interference cancellation play a major role in the electromagnetic wave absorption process of EG/PANI/Fe3O4 composites.