When the iPhone was first introduced, you had to connect it to a computer running iTunes to get new music, update the OS, subscribe to podcasts, back up content and restore your phone. Now -- to the joy of those for whom the iPhone is their only computing device -- iOS 8 allows you to factory reset your iPhone and then restore your content and settings without connecting to iTunes.
Back Up Your iPhone's Content to iCloud
Make sure you have iCloud Backup turned on and perform a backup. Select "iCloud" in the Settings App.
Set the toggles to the "On" position for all content to be included in the iCloud Backup, such as Photos, Contacts, Mail and Calendar.
Scroll down and tap "Backup" in the same iCloud Settings screen.
Slide the "iCloud Backup" toggle switch to the "On" position so that it is green. Then, tap "Back Up Now."
If you already have had iCloud backup turned on, this screen is also where you can check the date of the last backup.
Factory Reset Your iPhone and Restore Your Content
Go to "General" in the Settings app.
Tap "Erase All Content and Settings."
Tap "Erase iPhone." At this point, you may be asked to enter your passcode.
Be patient as your iPhone restarts and resets. After entering your preferred language and the country where you live, select "Restore from iCloud Backup."
Tap "Sign In With Your Apple ID."
There is an option to "Skip This Step." Use this if you are resetting the iPhone to sell it.
Select which backup to use to restore your apps, data and settings. IOS 8 keeps the three latest backups made for that iCloud account.
In some cases, the latest backup may not be the one you want to use. If you were having problems with your iPhone that forced you to factory reset, then you might want to use an earlier backup from a time the phone was working more reliably. Otherwise, go ahead and select the latest backup.