When your iPhone won't connect to Wi-Fi, the cause is probably either a connection and a settings problem, and you may need to try several troubleshooting fixes before you are back online.
Check Airplane Mode and Wi-Fi Settings
Tap Settings. If the Airplane Mode button is green, tap it to turn it off. This mode disables wireless functions, so switching it off may restore your connection. Check that Wi-Fi is on. If it is off, tap its button to open the settings screen and tap Wi-Fi to turn it on.
Enter the password for the Wi-Fi account, if prompted, and wait to see if the iPhone connects. If you can't change the Wi-Fi button or if you see an incorrect password error message, even though you're using the correct key, move on to other troubleshooting fixes.
Check Your Devices
Check if the Wi-Fi network is working on a computer or other device. Make sure your networking devices — router and modem or combo boxes — are turned on, that all cables are connected correctly and that you're close enough to the router to pick up a signal.
If the network connection is not working on your computer or other device, power down the networking devices, wait a couple of minutes and turn them on again to see if you can connect. If you can't connect any device to the network, you may have an outage.
If the connection is working, power down the iPhone to reset it. Hold the Sleep/Wake button and swipe the shutdown slider when it shows on the screen. When the iPhone closes down, hold down Sleep/Wake to restart it. If this doesn't reset the connection, switch off or unplug all networking devices, wait a couple of minutes and restart them.
Remove the Wi-Fi Network
Remove the Wi-Fi network from the iPhone and reinstall it. Before you do this, make sure you know the network's password — you need this to set up the network again.
Open Settings and then Wi-Fi. Tap the network you want to remove.
Tap Forget This Network and select Forget on the confirmation window.
Go back to Wi-Fi and select the network from the Choose a Network list. Type the network's password in the Password box and select Join.
Wait for the iPhone to reconnect to the network and check to see if you have a signal. If not, reset your network settings.
Reset Network Settings
Resetting network settings on an iPhone removes all current data, rolling the system back to default networking settings. Note that you lose saved passwords and keys when you reset, so make sure you know any passwords you'll need to rejoin networks later.
Tap Settings, open General and tap Reset.
Tap Reset Network Settings and enter the iPhone's passcode, if prompted.
Select Reset Network Settings from the confirmation window.
Wait for the iPhone to restart and try to connect to the Wi-Fi network.
If you still can't access Wi-Fi, try connecting your iPhone to another network. If it connects, you may have a network problem and should contact your Internet company. If the iPhone won't connect with any Wi-Fi network, contact Apple for support.