How many possible pattern locks are there on a 3x3 grid?

By Md Shakib Pramanik. Published .

There are 389,112 possible pattern locks on a normal 3x3 Android grid. This counts every pattern with 4 to 9 dots that the phone accepts. You can find this number in many places, so for this article it was checked with a small computer program. The program follows the same rules as the phone and counts every pattern one by one. It found the same number.

What rules decide the number?

Android doesn’t let you connect the dots in any order you want. That’s why the total is smaller than you might expect.

The rules are simple. A pattern needs at least 4 dots, and you can use each dot only once. A line can’t jump over a dot that you haven’t used yet. For example, if you draw from the top-left dot to the top-right dot, the phone automatically adds the top-middle dot. But a line can cross a dot that you already used, and that dot is not counted again. Moves like top-left to bottom-middle are also allowed, a bit like a knight in chess, because no dot sits exactly in between.

Three example patterns. First: a line from the top-left dot to the top-right dot picks up the top-middle dot. Second: a line crosses a dot that is already used, which is allowed. Third: “knight” moves where no dot sits exactly between the two dots.

The jumping rule removes a lot of patterns. If you could join the dots in any order, there would be 985,824 patterns with 4 to 9 dots. So this one rule removes more than half of them.

How many patterns are there for each length?

Dots in the pattern Possible patterns
4 1,624
5 7,152
6 26,016
7 72,912
8 140,704
9 140,704
Total (4 to 9) 389,112

Short patterns are only a small part of the total. Patterns with 4 or 5 dots are only about 2% of all patterns. Patterns with 8 or 9 dots are about 72%.

You may notice that 8 dots and 9 dots have the same number: 140,704. This is correct. When you have used 8 dots, only one dot is left, and you can always reach it, because any dot in the way is already used. So every 8-dot pattern can be finished in exactly one way.

The starting dot also makes a difference. If you start from the centre dot, there are 64,240 possible patterns. From a middle dot on the edge there are 43,176, and from a corner there are 38,042.

How was this counted?

The program starts from each of the 9 dots, one after another. From the current dot, it tries every unused dot as the next step. It skips any move that would jump over an unused dot. Every path with 4 or more dots is counted once. It keeps going until no more moves are possible. Nothing is estimated.

Which has more combinations, a pattern or a PIN?

Lock type Possible combinations
4-digit PIN 10,000
Pattern lock, 4 to 9 dots 389,112
6-digit PIN 1,000,000

So on paper, a pattern is much stronger than a 4-digit PIN, but weaker than a 6-digit PIN. Google’s own help page on setting a screen lock (opens in a new tab) recommends a 6-digit PIN for added security. iPhones don’t have a pattern lock at all. They use a passcode (opens in a new tab), together with Face ID or Touch ID.

In real life, patterns are easier to guess

All these numbers assume that every pattern is equally likely. But people don’t choose patterns at random. Patterns that are quick to draw, start in a corner or look like a letter are also the first ones a stranger will try.

There are also easier ways to find out someone’s pattern than guessing. In 2010, researchers at the University of Pennsylvania showed that an Android pattern can often be read from the finger marks on the screen (Smudge Attacks on Smartphone Touch Screens (opens in a new tab)). Someone can also just watch you draw it.

So what stops someone from simply trying all 389,112 patterns? The phone itself. After several wrong patterns in a row, it makes you wait.

A Redmi A5 lock screen with cracked glass showing “Try again in 14 seconds. Too many attempts with incorrect pattern” above the 3x3 dots.

My father’s Redmi A5 after a few wrong patterns. It makes you wait 30 seconds before the next try.

With these waits, nobody can try hundreds of thousands of patterns by hand.

How to choose a pattern that is harder to guess

  • Use 6 dots or more. There are only 1,624 patterns with 4 dots, but 26,016 with 6 dots.
  • Add a knight move or a line that crosses another line. These are less common and harder to read from finger marks.
  • Don’t start from a corner.
  • If you like letters, change the letter a little.

A longer pattern is also easier to forget, so make a backup. Draw it on the pattern lock tool, download the numbered picture and keep it in a private place. The guide on where a pattern picture is safe explains the good and bad places, and these tips help you remember your pattern.