We want to hand an iPhone 5 on to our granddaughter, but want to make sure that her enquiring mind won't find anything in the phone that she shouldn't. Credit card, bank account details etc. if we erase all settings will that clean the phone but leave the sim unaffected?
Rather than provide a link offsite, the short answer is yes.
Turn off find my iPhone and then go to settings > general > reset and tap the one that erases all content and settings. You will then (after a reboot) have an (effectively) factory fresh iPhone suitable for selling to a stranger or giving to a small child.
The SIM is not affected, and it will retain it's phone number and wireless plan if any.