While modern iPhones come with a selection of either Face ID or Touch ID as the main way to unlock the device, underneath both there's always a passcode that acts as a fallback option should the biometrics run awry. You most likely set this up when you first received your iPhone and haven't given it much thought since - but if you've yet to do so, we've already covered the process in How to set a passcode on iPhone.
But what if you want to change the code to a new or longer one? Here are the steps you need to take.
How do I change the passcode on my iPhone?
It's easy to change your iPhone passcode: all you need is the existing code and these instructions.
On your iPhone, open Settings then scroll down until you find either Face ID & Passcode or Touch ID & Passcode, depending on which one applies to your device. Select this and you'll be asked to enter your current passcode. Do so, then on the next page scroll down and tap the Change Passcode option.
You'll need to enter your existing passcode once more, then you'll be prompted to enter a new one to replace it.
iOS defaults to a six-digit code, but there are other configurations available if you tap Passcode Options. These include Custom Alphanumeric Code (one that combines numbers and letters), Custom NumericCode (as many numbers as you like) or the standard 4-Digit numeric Code.
Select the one you want to use, then enter the new code and verify it to complete the process.
When should I change my passcode?
Many people will set a passcode and then use it for the entire life of a device and even take it on to the next one with them. While there's nothing wrong with this, there are some instances where changing to a new one is advisable.
The main situation is if you think someone might have seen you enter your passcode, and thus could access your device if they got their hands on it. If this is the case, then it should be changed immediately.
There's also the fact that a higher number of digits in the code - or combining numbers and letter in the case of an alphanumeric - will increase the permutations available and make the code harder to crack. So, if you want to have the highest level of security on your iPhone, a longer passcode will go a long way to making it more secure.
If you've forgotten your passcode then you won't be able to change it without first wiping your iPhone. We explain this process in How to bypass a forgotten passcode on iPhone or iPad.