Set up a passcode to lock your iPhone screen
A passcode is a PIN or password that locks your iPhone so only you can unlock it. Without one, anyone who picks up your phone can see your messages, photos, banking apps, and personal information. You set this up in the Settings app, and it takes about two minutes.
The passcode is different from your Apple ID password (which you use to sign into the App Store and iCloud). This guide covers the screen lock passcode, which is what stops someone from using your phone if they have it in their hands.
Key Takeaways
- Open Settings, tap Face ID & Passcode (or Touch ID & Passcode on older models), then tap Turn Passcode On to create a four-digit or six-digit PIN.
- A six-digit passcode is more secure than four digits, but either one works — choose what you can remember without writing down.
- You can also use a custom alphanumeric password with letters and numbers instead of just digits, though it is harder to type on the lock screen.
- If you forget your passcode, you will need to erase the phone and set it up again using your Apple ID, so write it down or use a password manager.
- Once your passcode is set, your iPhone will lock automatically after a few minutes of not being used, and you will need to enter the code to unlock it.
Steps to add a passcode on iPhone
Open the Settings app (the gray gear icon on your home screen). Scroll down and tap Face ID & Passcode if you have an iPhone with Face ID (iPhone X and newer), or Touch ID & Passcode if you have an older model with a home button. You may need to unlock your phone first or enter your Apple ID password.
Tap Turn Passcode On at the top of the screen. Your iPhone will ask you to choose between a six-digit numeric code, a four-digit numeric code, or a custom alphanumeric password. Six digits is the default and most secure option — tap that unless you have a reason to choose something else.
Enter your passcode twice. The first time is when you create it; the second time is when you confirm it. Make sure you type the same numbers both times, or the phone will ask you to start over. Once you confirm, your passcode is active immediately.
Choosing between four digits, six digits, or a custom password
A six-digit passcode is the default because it offers more combinations than four digits (one million possible codes instead of ten thousand). If someone is trying to guess your code, six digits takes much longer. Most people should stick with six digits.
A four-digit passcode is faster to type on the lock screen, but it is easier to guess or crack. Choose this only if you unlock your phone dozens of times a day and the speed matters more to you than maximum security. If you have sensitive information on your phone (banking apps, work email, photos), use six digits.
A custom alphanumeric password can include letters, numbers, and symbols — for example, "iPhone2024!" — and is the most secure option. The downside is that typing it on the lock screen is slow and annoying because you have to switch between the number pad and the letter keyboard. Use this only if you rarely unlock your phone or if you have extremely sensitive data and want maximum protection.
What happens if you forget your passcode
If you forget your passcode, you cannot simply reset it through Settings. Instead, you will need to erase your iPhone completely and set it up again. This means losing all data on the phone unless you have a backup in iCloud or on a computer.
To erase and set up your phone again, you will need your Apple ID email and password. Go to iCloud.com on another device, sign in with your Apple ID, and use Find My iPhone to erase the phone remotely. Then set it up as new and create a passcode you will actually remember. This process takes 30 minutes to an hour.
The best way to avoid this is to write your passcode down and store it somewhere safe — not on a sticky note on your desk, but in a locked drawer or a password manager app like 1Password or Bitwarden. If you use a password manager, you can store a complex passcode without having to memorize it.
How to change or remove your passcode
To change your passcode, go back to Settings > Face ID & Passcode (or Touch ID & Passcode), enter your current passcode, and tap Change Passcode. You will enter your old passcode first, then create a new one and confirm it. This takes about one minute.
To remove your passcode entirely, go to Settings > Face ID & Passcode, enter your current passcode, and tap Turn Passcode Off. Your iPhone will ask you to confirm. Once you do, your phone will no longer lock — anyone can pick it up and see everything on it. Most people should not do this, but it is an option if you are in a secure location and do not want to unlock your phone repeatedly.
Why you should use a passcode even if you use Face ID or Touch ID
Face ID and Touch ID are convenient — you can unlock your phone by looking at it or touching the home button. But they are not a replacement for a passcode. Your iPhone requires a passcode as a backup in case Face ID or Touch ID fails, your face is covered, or your fingerprint is not recognized.
More importantly, if your phone is powered off, in a restart, or has not been unlocked in six days, Face ID and Touch ID will not work — you will need your passcode. A passcode is also required if someone tries to unlock your phone too many times and the phone locks them out temporarily. Think of the passcode as the final lock that Face ID and Touch ID sit on top of.
Auto-lock settings to protect your phone when you are not using it
Once your passcode is set, you can control how long your iPhone waits before automatically locking. Go to Settings > Display & Brightness > Auto-Lock and choose a time: 30 seconds, 1 minute, 2 minutes, 5 minutes, 10 minutes, or Never.
If you choose 30 seconds or 1 minute, your phone locks very quickly after you stop using it, which is more secure but means you will unlock it more often. If you choose 5 or 10 minutes, you can leave your phone unattended for a bit without it locking, but someone could pick it up and use it if you step away. Most people choose 1 or 2 minutes as a balance. Never choose "Never" unless your phone is in a locked room that only you can access.
Frequently Asked Questions
Can I use a word instead of numbers for my passcode?
Yes, if you choose the custom alphanumeric option when you set up your passcode. You can use letters, numbers, and symbols — for example, "BlueSky42!" — but typing it on the lock screen is slower than typing numbers. Most people stick with numbers for speed.
What is the difference between my passcode and my Apple ID password?
Your passcode locks your phone screen and is stored only on your iPhone. Your Apple ID password signs you into the App Store, iCloud, and other Apple services, and is stored on Apple's servers. You need both — losing your Apple ID password does not affect your passcode, and vice versa.
If I set a passcode, can someone still see my data if they have my phone?
Not without your passcode. Once your phone is locked, they cannot access your messages, photos, apps, or any personal information without entering the correct code. This is why a strong passcode matters — a four-digit code can be guessed in minutes, but a six-digit code takes much longer.
Do I have to use Face ID or Touch ID if I have a passcode?
No. You can turn off Face ID or Touch ID in Settings and unlock your phone with only your passcode. Some people do this if they do not trust facial recognition or fingerprint scanning, or if they prefer the extra step of typing a code. You can also use both — Face ID or Touch ID for everyday unlocking, and your passcode as a backup.
What happens if I enter my passcode wrong too many times?
After six wrong attempts, your iPhone will disable unlocking for one minute. After ten wrong attempts, it disables for five minutes. After fifteen wrong attempts, it disables for 60 minutes or longer. This is designed to stop someone from guessing your code by trying many combinations in a row. If you are locked out, wait the required time and try again.