Keys rust when exposed to moisture, and rust affects the way a key fits into a lock by slowly dissolving the shape of the key. This causes problems because locks require a key with an exact shape to open. And once a key's teeth, the jagged part, have dissolved, a copy can't be made. The key is ruined and a locksmith needs to make a key from the lock, which can be expensive and time consuming. Keep keys dry to prevent rusting in the first place; if you have rusted keys, use vinegar to remove the rust.
Wipe off any dirt or debris covering the rusted keys. Vinegar works better when it can make direct contact with the rust.
Simmer enough vinegar to cover the keys in a saucepan. Don't put the keys into the saucepan, though.
Pour the vinegar into a bowl. Add the keys. Allow the keys to soak for 30 minutes. If the rust layer is thick, soak for another 30 minutes.
Take out the keys. Use a toothbrush to scrub off the rust. If rust remains, soak for another hour. The acid in the vinegar removes rust.
Wipe off all residue with a rag. Don't worry--the vinegar smell disappears after a little while.