When formatting windows 7 because of malware, is it safe to just reset or do a total reinstallation?

I’ve got an old system I haven’t used in a while. I got a new one after I discovered it was infested with malware. I want to give it out as a gift but I want to make sure I’m not giving out something harmful. I would like to know if doing a reset will get rid of the malware or if I need to do a complete reinstallation.