# How strong is a 5×5 pattern? The math, and the humans

A Cachette pattern can be any of 42 septillion dot sequences, about 85 bits. People choose far fewer. The count, the studies, and what each guess costs.

Published 23 November 2026. 8 min read.

On paper, a 5×5 pattern is very strong. Counting every ordered sequence of 6 to 25 distinct dots on Cachette's grid gives 42,163,840,398,198,058,848,000,000 possibilities, about 85 bits. The 6-dot minimum alone allows 127,512,000, roughly 328 times all 389,112 patterns of Android's 3×3 lock. In practice, strength depends on things the count can't see: which sequences are easy to draw, whether yours is a shape people commonly pick, and how much each guess costs.

Here's the count and the code behind it, what research says about the patterns people choose, what Cachette's setup blocks, and what slow guessing on the phone itself changes.

## Counting Android's 3×3 patterns

Android's lock connects 4 to 9 of the 9 dots, each at most once, and fills in any unused dot your line crosses. As [Forman and Aviv](https://arxiv.org/abs/2008.10681) put the rule, "any unselected point cannot be avoided or traced over without being previously selected." That removes every move that jumps an unused dot, and what's left is the well-known figure: "In total there are 389,112 possible patterns."

The number is easy to reproduce. A short search that walks every path from every starting dot, refusing moves that jump an unused dot, gives the same total:

| Dots | Patterns |
|---|---|
| 4 | 1,624 |
| 5 | 7,152 |
| 6 | 26,016 |
| 7 | 72,912 |
| 8 | 140,704 |
| 9 | 140,704 |
| **Total** | **389,112** |

Without the jumping rule, any order of 4 to 9 distinct dots would give 985,824, so the rule removes more than half the space.

## Counting Cachette's 5×5 patterns

Cachette's grid works differently. A pattern uses at least 6 of the 25 dots, each once, and a dot is added when your finger touches it. Cachette never adds a dot by itself just because your line crosses it, but a dot your finger passes over counts as touched. There are gaps between the dots, so a careful finger can steer around a dot, which means any order of distinct dots can be drawn in principle. That makes the theoretical count simple: a pattern of k dots is an ordered selection, a permutation, of k dots out of 25.

P(25, k) = 25 × 24 × … × (25 − k + 1)

The total is the sum for k from 6 to 25, and Python's standard library computes it exactly:

```python
from math import perm, log2

total = 0
for k in range(6, 26):
    n = perm(25, k)  # ordered choices of k distinct dots out of 25
    total += n
    print(k, f"{n:,}", f"{log2(n):.1f} bits")

print(f"{total:,}", f"{log2(total):.1f} bits")
```

Running it gives:

| Dots | Sequences | Bits |
|---|---|---|
| 6 | 127,512,000 | 26.9 |
| 7 | 2,422,728,000 | 31.2 |
| 8 | 43,609,104,000 | 35.3 |
| 9 | 741,354,768,000 | 39.4 |
| 10 | 11,861,676,288,000 | 43.4 |
| … | … | … |
| 24 | 15,511,210,043,330,985,984,000,000 | 83.7 |
| 25 | 15,511,210,043,330,985,984,000,000 | 83.7 |
| **6 to 25** | **42,163,840,398,198,058,848,000,000** | **85.1** |

The 24-dot and 25-dot counts are equal, because once 24 dots are placed the last one has only one place to go. Those two lengths alone make up 73.6% of the total, the first sign that the headline number says little about real patterns: nobody draws 24 dots to open a photo vault.

### What "in principle" leaves out

Steering around a dot takes care, especially in the middle of the grid, where straight lines between distant dots run through others. Draw straight strokes and your finger enters every dot that sits exactly on the line, so those dots are added. Counting only the sequences you can draw that way, where no move jumps an unused dot on its path, the same kind of search gives at most 19,174,112 six-dot sequences, about 15% of the theoretical figure and 24.2 bits, and at most 261,248,096 seven-dot ones, about 28 bits. Read the big table as the size of the space, and this as a reminder that the part that's easy to draw is much smaller.

## From counts to bits

Guessing difficulty is measured in bits: the base-2 logarithm of the number of equally likely possibilities, so each bit doubles the work. Bits only describe a secret chosen at random from the whole space, so read this table as a ceiling, not a measurement:

| Secret | Possible values | Bits if chosen at random |
|---|---|---|
| 4-digit PIN | 10,000 | 13.3 |
| Android 3×3 pattern | 389,112 | 18.6 |
| 6-digit PIN | 1,000,000 | 19.9 |
| Cachette, exactly 6 dots | 127,512,000 | 26.9 |
| Cachette, exactly 8 dots | 43,609,104,000 | 35.3 |
| Cachette, any length | about 4.2 × 10²⁵ | 85.1 |

Each extra dot multiplies the count: by 19 going from 6 dots to 7, by 18 from 7 to 8, and by 17 from 8 to 9. The ceiling is high. The question is how close real people come to it.

## What people actually draw

Researchers have studied thousands of Android patterns drawn by real people, and the findings agree.

- **Strong habits.** [Uellenbeck, Dürmuth, Wolf and Holz](https://passwordresearch.com/papers/paper456.html) (ACM CCS 2013) found "a high bias in the pattern selection process," with "the upper left corner and three-point long straight lines" among the "very typical selection strategies." They estimated that for guessing 20% of patterns, the scheme offered less security than "only three digit randomly-assigned PINs".
- **Bigger grids help less than you'd hope.** [Aviv, Budzitowski and Kuber](https://acsac.org/2015/program-final/s58.html) (ACSAC 2015) collected 934 patterns on 3×3 grids and 504 on 4×4. They found that guessing the first 20% on either grid "can be done as efficiently as guessing a random 2-digit PIN." Guessing half the 4×4 patterns took 2 bits more than on 3×3, "still on the order of cracking random 3-digit PINs," and "many of the 4x4 patterns are similar versions of 3x3 patterns distributed over the larger grid space."

Those studies looked at 3×3 and 4×4 grids, not 5×5, so they don't give a number for Cachette. What they show is that grid size and real strength are different things. A larger grid raises the ceiling; it doesn't change the habits people bring to it.

### Watching is cheaper than guessing

Some attacks skip guessing entirely. In an online study with 1,173 participants, [Aviv, Davin, Wolf and Kuber](https://arxiv.org/abs/1709.04959) (ACSAC 2017) found that 6-dot Android patterns were recreated after one observation 64.2% of the time, against 10.8% for 6-digit PINs; without the drawn lines, the pattern figure fell to 35.3%. An earlier [smudge study](https://www.usenix.org/legacy/event/woot10/tech/full_papers/Aviv.pdf) (USENIX WOOT 2010) found that in one experiment a pattern was "partially identifiable in 92% and fully in 68% of the tested lighting and camera setups." And a [2017 video attack](https://www.ndss-symposium.org/ndss2017/ndss-2017-programme/cracking-android-pattern-lock-five-attempts/) tracked fingertip movement in phone-camera footage and could "break over 95% of the patterns in five attempts" without seeing the screen.

That's not a reason to worry, just a reason for two easy habits: shield the screen when you draw near other people, and wipe it now and then. With a screen reader on, Cachette speaks the dots aloud, so headphones help in company.

## What the setup blocklist removes

Cachette's setup refuses very common shapes with a plain message: straight lines, letters, corner runs, the outer ring and the most common published patterns. You draw your pattern twice, and a refused one simply asks you for another.

That aims squarely at the habits above. A guessing list starts with exactly those shapes, so removing them takes away the guesses most likely to work first. What a blocklist can't do is make a human choice random. Everything left is still picked by a person, with a person's habits, which is why [how to choose a pattern](https://getcachette.app/blog/how-to-choose-a-pattern/) matters more than any count here: use more dots than the minimum, start away from the corners, change direction, and pick something you'll still remember in a year, because nobody can reset it.

## What guessing costs on Cachette

Here the key derivation changes the picture. Cachette's vault key comes from Argon2id with 128 MiB of memory, 3 passes and 4 lanes, followed by an HMAC with a pepper key held in the phone's hardware keystore. The pepper can't be exported, so the vault's files, copied off the phone, can't be attacked on another computer: every guess against them has to run on the phone and pay for a full Argon2id. [Argon2id vs PBKDF2](https://getcachette.app/blog/argon2id-vs-pbkdf2/) explains why that pairing matters for short secrets.

To show the scale, assume one guess per second. That's an assumption, not a measurement. It's generous to anyone drawing by hand, since every attempt holds the screen for a full second before anything appears, and someone who had taken over the phone's software might go somewhat faster or slower depending on the phone.

| To try | Guesses | At one per second |
|---|---|---|
| 1,000 likely patterns | 1,000 | about 17 minutes |
| Every 4-digit PIN | 10,000 | about 2.8 hours |
| Every Android 3×3 pattern | 389,112 | about 4.5 days |
| Every 6-dot sequence drawable with straight strokes | 19,174,112 | about 222 days |
| Every 6-dot Cachette sequence | 127,512,000 | about 4 years |
| Every 7-dot Cachette sequence | 2,422,728,000 | about 77 years |
| Every 8-dot Cachette sequence | 43,609,104,000 | about 1,380 years |

Read it from both ends. A pattern from the top of the human list, the corners, lines and letters, falls in minutes whatever the grid, which is why the blocklist exists. A pattern that isn't on anyone's list sits in a space that can't be walked at this pace. On average a search finds a randomly chosen pattern halfway through, which halves these times without changing the picture.

Two more properties help. There's no wrong-pattern message: a guess that opens an empty vault looks exactly like a new vault, and finding one vault never tells anyone whether another exists. And all of it happens on your phone, one guess at a time.

One exception deserves a straight answer. A backup has to restore on a phone that never had your pepper, so the check that lets a restore confirm your pattern is made with the same Argon2id settings and no pepper. That check is sealed inside the backup by its 24 words, so a copy of the file on its own gives nothing to test patterns against. Someone holding both the file and its 24 words could open the backup and test patterns against the check on their own hardware, as fast as that hardware runs a 128 MiB Argon2id, and a pattern found that way would open that vault on your phone. Keep the words on paper, apart from the file, and count it as one more reason to choose a pattern that isn't a common shape. [Inside Cachette's encryption](https://getcachette.app/blog/inside-cachette-encryption/) covers the backup design.

The short version: the 5×5 grid gives you room, the key derivation makes every guess on the phone cost real time, and your own choice decides whether either matters. [Pattern vs PIN vs password](https://getcachette.app/blog/pattern-vs-pin-vs-password/) compares the three kinds of secret if you're deciding what to use elsewhere.

## Questions

### How many Android pattern lock combinations are there?

Android's 3×3 grid allows 389,112 patterns of 4 to 9 dots, counting its rule that a line can't skip over a dot that hasn't been used yet. That's about 18.6 bits, between a 4-digit PIN (13.3 bits) and a 6-digit PIN (19.9 bits).

### How many patterns are possible on a 5×5 grid?

Counting every ordered sequence of 6 to 25 distinct dots out of 25, there are 42,163,840,398,198,058,848,000,000, about 85.1 bits. Sequences of exactly 6 dots number 127,512,000, about 26.9 bits, and far fewer of those are easy to draw with straight strokes.

### Are pattern locks weaker than PINs?

Patterns are easier to watch. In a 2017 study, 6-dot Android patterns were recreated after a single observation 64.2% of the time, against 10.8% for 6-digit PINs. People also choose patterns predictably, so a pattern's real strength depends on avoiding common shapes.

---

Canonical page: https://getcachette.app/blog/pattern-lock-math/
Last updated: 2026-11-23
