The study of Fe3O4/water nanofluid in a lid-driven cavity under mixed convection conditions has been carried out with a focus on the effect of a non-uniform magnetic field on the heat exchange process. The governing equations, including continuity, momentum, and energy, were resolved using the Finite Volume Method-based in-house solver. Several parameters were considered in the analysis, including Magnetic number, the shape of nanoparticles (cylindrical, spherical, platelet, and brick), and the Reynolds number. The results were presented in the form of isotherms and streamlines, local and average Nusselt numbers. The results showed that applying a non-uniform magnetic field positively impacts the heat exchange process. In addition, an optimal condition was defined based on the shape of nanoparticles, Magnetic number, and Reynolds number. These findings contribute to understanding the dynamics and thermals of ferrofluids in lid-driven cavities and have implications for improving heat transfer applications.