Given the adverse effects of organic dyes from aqueous solutions on human physiology and the ecological system, establishing an effective system for their elimination is imperative. This study employs the in situ thermal (IST) method to synthesize nanocomposites comprising zeolitic imidazole frameworks, specifically Fe-ZIF-8 and Fe-ZIF-67. The investigation offers a comprehensive evaluation of the properties of these nano-adsorbents for the removal of malachite green (MG). The results indicate a significantly increased adsorption capacity of up to 495 and 552 mg g−1 for Fe-ZIF-8 and Fe-ZIF-67, respectively. Furthermore, they demonstrate removal efficiencies of up to 90% and 95% for MG, respectively. Parameters associated with the adsorption process are derived from isotherms and removal kinetics, specifically the Freundlich model and the pseudo-second-order kinetics model, respectively. The enhanced adsorption capacity observed in Fe-ZIF-8 and Fe-ZIF-67 can be attributed to π–π stacking interactions, hydrogen bonding, and electrostatic attraction. After undergoing three cycles, both adsorbents consistently exhibit a high removal efficiency of approximately 85%, indicating notable structural integrity and outstanding potential for repeated use. The examined adsorbents display exceptional efficacy, favorable stability, and substantial specific surface area, underscoring their remarkable adsorption capabilities. The nanocomposites comprising Fe-ZIF-8 and Fe-ZIF-67 demonstrate considerable potential as highly favorable options for the elimination of MG and other cationic organic dyes from aqueous environments. © 2025 Elsevier B.V., All rights reserved.