If someone picks up your iPhone, how long would it take them to guess the passcode? The honest answer has two parts: how many codes are possible, which is simple arithmetic, and how fast anyone can try them, which Apple deliberately keeps slow. This calculator does the arithmetic for 4-digit and 6-digit PINs, longer numeric and alphanumeric codes, and pattern locks, at the speeds Apple and common security tools use. It's for anyone choosing a passcode or wondering whether a lost phone is at risk. We make Noxium, an encrypted photo vault that opens with a pattern, and built this page so you can compare the options yourself.
How do you use the calculator?
Pick the kind of passcode and a guessing speed. The results update as you change them.
- Choose the kind of passcode. A 4-digit or 6-digit PIN, a longer numeric code, an alphanumeric code, or a pattern on a 5 × 5 plate.
- Set the length. For longer codes, enter the number of digits or characters, and tick the kinds of character the code can use. For patterns, enter the number of bolts.
- Choose a guessing speed. Start with Apple's 80 milliseconds per attempt for an iPhone. The other presets show online and offline attacks on accounts, for comparison.
- Read the results. You get the number of possible codes, the time to try every one, the average time (half of that), and the chance that 10 guesses would hit a randomly chosen code.
Don't enter your real passcode anywhere on this page. The calculator never asks for it: only its kind and length matter.
How many codes does each passcode allow?
Each extra digit multiplies the possibilities by 10, and each extra character by the number of characters it can be. Here are the results at Apple's 80 ms per attempt, if nothing else slowed the guessing down.
| Passcode | Possible codes | Time to try all |
|---|---|---|
| 4-digit PIN | 10,000 | 13 minutes |
| 6-digit PIN | 1,000,000 | 22 hours |
| 8-digit code | 100,000,000 | 93 days |
| 6 characters, a–z and 0–9 | 2,176,782,336 | 5.5 years |
| 8 characters, any keyboard character | 6,634,204,312,890,625 | 17 million years |
| Pattern, 6 of 25 bolts | At most 127,512,000 | 118 days |
| Pattern, 8 of 25 bolts | At most 43,609,104,000 | 111 years |
The 5.5-year row matches Apple's own example: its security guide says trying every six-character code of lowercase letters and numbers would take more than five and a half years. All these numbers assume the code was chosen at random. A birthday, 123456 or a repeated digit is found long before the halfway point, because attackers try the popular codes first.
Why can't someone guess an iPhone passcode faster?
Because Apple makes every guess happen on the phone itself, slowly. According to Apple's Platform Security guide, the passcode is entangled with a unique key built into the device's hardware, so brute-force attempts have to be made on the device under attack. Turning a passcode into a key runs a deliberately slow calculation whose iteration count is "calibrated so that one attempt takes approximately 80 milliseconds". That's where the calculator's iPhone preset comes from: about 12.5 guesses a second, at most.
On top of that, the Secure Enclave enforces escalating delays after failed attempts at the Lock Screen. Apple's table for iPhone and iPad lists:
| Attempts | Delay |
|---|---|
| 3 | None |
| 4 | 1 minute |
| 5 | 5 minutes |
| 6 | 15 minutes |
| 7 | 1 hour |
| 8 | 3 hours |
| 9 | 8 hours |
| 10 or more | The device is locked and must connect to a Mac or PC |
Apple adds that restarting the device during a delay doesn't skip it. So at the Lock Screen, someone gets about 10 tries. For a random 6-digit PIN, 10 guesses have a 1 in 100,000 chance (0.001%) of finding it. For a random 4-digit PIN, it's 1 in 1,000.
What does "Erase Data after 10 failed attempts" do?
It erases the iPhone instead of locking it. Go to Settings › Face ID & Passcode (Touch ID & Passcode on iPhones with Touch ID), enter your passcode, and turn on Erase Data. Apple's passcode article describes it as erasing the device automatically after ten failed passcode attempts; with it off, the device has to be restored with a computer after ten failed attempts. The security guide adds that entering the same wrong passcode again doesn't count toward the limit, and that an organization managing the device can set a lower number.
Erase Data makes guessing pointless, but it also means a child playing with your phone could wipe it. Turn it on only if your photos and data are backed up. The same Settings screen has Change Passcode, where Passcode Options lets you choose a 4-digit code, a custom numeric code or a custom alphanumeric code instead of the default 6 digits.
Where do the other speeds come from?
Only the iPhone preset is Apple's figure. The other three are illustrative assumptions borrowed from zxcvbn, the password estimator also behind our password strength checker. Its documentation uses 100 guesses an hour for an online service that limits sign-in attempts, 10 a second for one that doesn't, and a ballpark of 10 billion a second for an offline attack on leaked passwords stored with a fast hash, noting a reasonable range of one billion to one trillion. They describe accounts and leaked databases, not iPhones. Choose My own number to try any other speed.
What about pattern locks?
The calculator counts a pattern as an ordered choice of different bolts on a 5 × 5 plate, the plate Noxium uses. Choosing 6 of 25 bolts in order gives 25 × 24 × 23 × 22 × 21 × 20 = 127,512,000 sequences. That's an upper limit: not every sequence can be drawn as one line, so real patterns are fewer. And as our pattern lock page explains, a study of Android's pattern lock found people's real patterns were about as easy to crack as a random 3-digit PIN for half of the patterns collected. Shapes like an L, a Z or your initial go first. Noxium turns your pattern into its keys with Argon2id, a function built to make every guess slow, but this calculator doesn't assume a guessing speed for it. Pick a preset or enter your own to see how the count holds up.
What happens to your data?
Nothing is collected. The calculator is a few lines of arithmetic that run in this browser tab: it multiplies the number of choices per position, divides by the guessing speed and turns the seconds into words. It uses exact whole-number maths for long codes, so a 25-bolt pattern's 15,511,210,043,330,985,984,000,000 sequences come out exactly. It never asks for your passcode and makes no network requests. The page does load Google Analytics, which counts visits as our privacy policy describes; it never receives anything you enter.
What doesn't the calculator account for?
It measures the size of the haystack, not how people pick the needle.
- Predictable codes. All results assume a random passcode. Common codes, dates and simple shapes fall much sooner.
- Watching you type. Someone who sees your passcode over your shoulder doesn't need to guess. Use Face ID or Touch ID in public.
- The delay schedule. The times ignore the iPhone's escalating delays and its 10-attempt limit, which matter far more than raw speed at the Lock Screen.
- Flaws and special tools. The figures assume the phone's protections work as Apple describes. Keep iOS up to date.
- Unlocked moments. No passcode helps while the phone is unlocked in someone else's hands.
For photos you want to protect even when the phone is unlocked, a second lock helps. Our guide to locking photos with Face ID covers the options. And if you'd rather use a long random code for an account, the password generator makes one in your browser.
A second lock for private photos
Noxium keeps photos, videos and notes in encrypted vaults on your iPhone. You open them by drawing a pattern across at least 6 of 25 bolts; keys come from your pattern through Argon2id, and the pattern is never stored.
Download on the App Store Available on the App Store for iPhone and iPad.Questions people ask
How long does it take to crack a 6-digit iPhone passcode?
Trying all 1,000,000 codes at Apple's 80 milliseconds per attempt would take about 22 hours, and 11 hours on average. That is only possible if the Lock Screen's escalating delays and 10-attempt limit could be avoided; at the Lock Screen, an attacker gets about 10 tries.
Is a 4-digit passcode safe enough?
It's much weaker than 6 digits. A 4-digit PIN has 10,000 codes, and 10 random guesses have a 1 in 1,000 chance of hitting it, against 1 in 100,000 for 6 digits. And 4 digits are easy to fill with something predictable, such as a year. Use at least 6 digits, or an alphanumeric code.
What happens after 10 failed passcode attempts on an iPhone?
Apple's security guide says the device is locked and must connect to a Mac or PC. If you turned on Erase Data in Settings › Face ID & Passcode, the iPhone erases all content and settings instead. Repeating the same wrong passcode doesn't count again.
Is a pattern lock harder to guess than a PIN?
In theory, yes: 6 bolts in order on a 5 × 5 plate allow at most 127,512,000 sequences, against 1,000,000 for a 6-digit PIN. In practice, people draw predictable shapes, so a short, obvious pattern can be weaker than a random PIN. Use more bolts and change direction.
What is the most secure kind of iPhone passcode?
A custom alphanumeric code, because each character can be any of dozens of options instead of 10. Eight random characters from the whole keyboard allow over 6.6 quadrillion codes. Choose it under Settings › Face ID & Passcode › Change Passcode › Passcode Options.
Something wrong or out of date? Email business@inertiaprojects.info and we'll fix it.